{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Multilayer Perceptron\n",
    "\n",
    "In the previous chapters, we showed how you could implement multiclass logistic regression (also called softmax regression)\n",
    "for classifying images of clothing into the 10 possible categories.\n",
    "To get there, we had to learn how to wrangle data,\n",
    "coerce our outputs into a valid probability distribution (via `softmax`),\n",
    "how to apply an appropriate loss function,\n",
    "and how to optimize over our parameters.\n",
    "Now that we’ve covered these preliminaries,\n",
    "we are free to focus our attention on\n",
    "the more exciting enterprise of designing powerful models\n",
    "using deep neural networks.\n",
    "\n",
    "## Hidden Layers\n",
    "\n",
    "Recall that for linear regression and softmax regression,\n",
    "we mapped our inputs directly to our outputs\n",
    "via a single linear transformation:\n",
    "\n",
    "$$\n",
    "\\hat{\\mathbf{o}} = \\mathrm{softmax}(\\mathbf{W} \\mathbf{x} + \\mathbf{b})\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg height=\"88pt\" version=\"1.1\" viewBox=\"0 0 275 88\" width=\"275pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol id=\"glyph0-0\" overflow=\"visible\">\n",
       "<path d=\"M 1.125 0 L 1.125 -5.625 L 5.625 -5.625 L 5.625 0 Z M 1.265625 -0.140625 L 5.484375 -0.140625 L 5.484375 -5.484375 L 1.265625 -5.484375 Z M 1.265625 -0.140625 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph0-1\" overflow=\"visible\">\n",
       "<path d=\"M -0.015625 0 L 2.015625 -2.375 L 0.859375 -4.671875 L 1.734375 -4.671875 L 2.125 -3.84375 C 2.269531 -3.53125 2.398438 -3.226562 2.515625 -2.9375 L 3.875 -4.671875 L 4.84375 -4.671875 L 2.875 -2.3125 L 4.0625 0 L 3.171875 0 L 2.71875 -0.953125 C 2.613281 -1.148438 2.5 -1.398438 2.375 -1.703125 L 0.984375 0 Z M -0.015625 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph0-2\" overflow=\"visible\">\n",
       "<path d=\"M 0.4375 -1.765625 C 0.4375 -2.679688 0.707031 -3.4375 1.25 -4.03125 C 1.6875 -4.519531 2.265625 -4.765625 2.984375 -4.765625 C 3.546875 -4.765625 4 -4.585938 4.34375 -4.234375 C 4.6875 -3.890625 4.859375 -3.421875 4.859375 -2.828125 C 4.859375 -2.285156 4.75 -1.785156 4.53125 -1.328125 C 4.3125 -0.867188 4.003906 -0.515625 3.609375 -0.265625 C 3.210938 -0.015625 2.789062 0.109375 2.34375 0.109375 C 1.976562 0.109375 1.644531 0.03125 1.34375 -0.125 C 1.050781 -0.28125 0.828125 -0.5 0.671875 -0.78125 C 0.515625 -1.070312 0.4375 -1.398438 0.4375 -1.765625 Z M 1.234375 -1.84375 C 1.234375 -1.40625 1.335938 -1.070312 1.546875 -0.84375 C 1.765625 -0.625 2.035156 -0.515625 2.359375 -0.515625 C 2.523438 -0.515625 2.691406 -0.546875 2.859375 -0.609375 C 3.023438 -0.679688 3.179688 -0.785156 3.328125 -0.921875 C 3.472656 -1.066406 3.59375 -1.226562 3.6875 -1.40625 C 3.789062 -1.582031 3.875 -1.773438 3.9375 -1.984375 C 4.03125 -2.273438 4.078125 -2.554688 4.078125 -2.828125 C 4.078125 -3.242188 3.96875 -3.566406 3.75 -3.796875 C 3.539062 -4.035156 3.273438 -4.15625 2.953125 -4.15625 C 2.703125 -4.15625 2.472656 -4.09375 2.265625 -3.96875 C 2.066406 -3.851562 1.882812 -3.679688 1.71875 -3.453125 C 1.550781 -3.222656 1.425781 -2.957031 1.34375 -2.65625 C 1.269531 -2.351562 1.234375 -2.082031 1.234375 -1.84375 Z M 1.234375 -1.84375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-0\" overflow=\"visible\">\n",
       "<path d=\"M 0.875 0 L 0.875 -4.375 L 4.375 -4.375 L 4.375 0 Z M 0.984375 -0.109375 L 4.265625 -0.109375 L 4.265625 -4.265625 L 0.984375 -4.265625 Z M 0.984375 -0.109375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-1\" overflow=\"visible\">\n",
       "<path d=\"M 1.6875 0 L 2.484375 -3.78125 C 2.140625 -3.507812 1.65625 -3.296875 1.03125 -3.140625 L 1.15625 -3.703125 C 1.457031 -3.828125 1.757812 -3.988281 2.0625 -4.1875 C 2.363281 -4.382812 2.585938 -4.554688 2.734375 -4.703125 C 2.828125 -4.796875 2.914062 -4.90625 3 -5.03125 L 3.359375 -5.03125 L 2.3125 0 Z M 1.6875 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-2\" overflow=\"visible\">\n",
       "<path d=\"M 0.40625 0 C 0.46875 -0.300781 0.554688 -0.550781 0.671875 -0.75 C 0.785156 -0.945312 0.9375 -1.132812 1.125 -1.3125 C 1.3125 -1.5 1.671875 -1.804688 2.203125 -2.234375 C 2.523438 -2.492188 2.75 -2.6875 2.875 -2.8125 C 3.039062 -2.988281 3.160156 -3.160156 3.234375 -3.328125 C 3.285156 -3.441406 3.3125 -3.566406 3.3125 -3.703125 C 3.3125 -3.929688 3.226562 -4.125 3.0625 -4.28125 C 2.90625 -4.445312 2.707031 -4.53125 2.46875 -4.53125 C 2.238281 -4.53125 2.035156 -4.445312 1.859375 -4.28125 C 1.679688 -4.125 1.554688 -3.863281 1.484375 -3.5 L 0.875 -3.59375 C 0.9375 -4.039062 1.109375 -4.390625 1.390625 -4.640625 C 1.679688 -4.898438 2.039062 -5.03125 2.46875 -5.03125 C 2.75 -5.03125 3.003906 -4.96875 3.234375 -4.84375 C 3.460938 -4.726562 3.632812 -4.5625 3.75 -4.34375 C 3.875 -4.132812 3.9375 -3.914062 3.9375 -3.6875 C 3.9375 -3.351562 3.816406 -3.035156 3.578125 -2.734375 C 3.429688 -2.535156 3.003906 -2.15625 2.296875 -1.59375 C 1.984375 -1.351562 1.753906 -1.15625 1.609375 -1 C 1.460938 -0.84375 1.351562 -0.695312 1.28125 -0.5625 L 3.515625 -0.5625 L 3.390625 0 Z M 0.40625 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-3\" overflow=\"visible\">\n",
       "<path d=\"M 0.390625 -1.3125 L 0.984375 -1.390625 C 1.023438 -1.035156 1.125 -0.78125 1.28125 -0.625 C 1.4375 -0.476562 1.644531 -0.40625 1.90625 -0.40625 C 2.207031 -0.40625 2.46875 -0.515625 2.6875 -0.734375 C 2.914062 -0.953125 3.03125 -1.203125 3.03125 -1.484375 C 3.03125 -1.734375 2.945312 -1.9375 2.78125 -2.09375 C 2.613281 -2.257812 2.390625 -2.34375 2.109375 -2.34375 C 2.078125 -2.34375 2.007812 -2.335938 1.90625 -2.328125 L 2.015625 -2.84375 C 2.078125 -2.832031 2.132812 -2.828125 2.1875 -2.828125 C 2.539062 -2.828125 2.8125 -2.910156 3 -3.078125 C 3.1875 -3.253906 3.28125 -3.46875 3.28125 -3.71875 C 3.28125 -3.945312 3.203125 -4.140625 3.046875 -4.296875 C 2.890625 -4.453125 2.703125 -4.53125 2.484375 -4.53125 C 2.253906 -4.53125 2.050781 -4.445312 1.875 -4.28125 C 1.695312 -4.125 1.585938 -3.898438 1.546875 -3.609375 L 0.9375 -3.734375 C 1.03125 -4.148438 1.21875 -4.46875 1.5 -4.6875 C 1.789062 -4.914062 2.128906 -5.03125 2.515625 -5.03125 C 2.929688 -5.03125 3.265625 -4.90625 3.515625 -4.65625 C 3.773438 -4.40625 3.90625 -4.101562 3.90625 -3.75 C 3.90625 -3.476562 3.832031 -3.242188 3.6875 -3.046875 C 3.550781 -2.847656 3.347656 -2.6875 3.078125 -2.5625 C 3.265625 -2.445312 3.40625 -2.304688 3.5 -2.140625 C 3.601562 -1.972656 3.65625 -1.785156 3.65625 -1.578125 C 3.65625 -1.128906 3.488281 -0.738281 3.15625 -0.40625 C 2.820312 -0.0820312 2.421875 0.078125 1.953125 0.078125 C 1.492188 0.078125 1.125 -0.046875 0.84375 -0.296875 C 0.570312 -0.546875 0.421875 -0.882812 0.390625 -1.3125 Z M 0.390625 -1.3125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-4\" overflow=\"visible\">\n",
       "<path d=\"M 2.09375 0 L 2.359375 -1.28125 L 0.3125 -1.28125 L 0.453125 -1.890625 L 3.25 -5.015625 L 3.765625 -5.015625 L 3.09375 -1.828125 L 3.796875 -1.828125 L 3.6875 -1.28125 L 2.984375 -1.28125 L 2.703125 0 Z M 2.46875 -1.828125 L 2.90625 -3.921875 L 1.046875 -1.828125 Z M 2.46875 -1.828125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-5\" overflow=\"visible\">\n",
       "<path d=\"M 0.484375 -1.4375 L 1.125 -1.5 C 1.113281 -1.40625 1.109375 -1.347656 1.109375 -1.328125 C 1.109375 -1.179688 1.144531 -1.03125 1.21875 -0.875 C 1.300781 -0.726562 1.40625 -0.613281 1.53125 -0.53125 C 1.664062 -0.445312 1.804688 -0.40625 1.953125 -0.40625 C 2.140625 -0.40625 2.332031 -0.46875 2.53125 -0.59375 C 2.726562 -0.726562 2.890625 -0.921875 3.015625 -1.171875 C 3.140625 -1.429688 3.203125 -1.6875 3.203125 -1.9375 C 3.203125 -2.21875 3.117188 -2.441406 2.953125 -2.609375 C 2.785156 -2.773438 2.566406 -2.859375 2.296875 -2.859375 C 2.117188 -2.859375 1.945312 -2.8125 1.78125 -2.71875 C 1.625 -2.632812 1.476562 -2.507812 1.34375 -2.34375 L 0.796875 -2.375 L 1.5625 -4.9375 L 4 -4.9375 L 3.890625 -4.375 L 1.984375 -4.375 L 1.609375 -3.09375 C 1.742188 -3.195312 1.882812 -3.273438 2.03125 -3.328125 C 2.1875 -3.378906 2.34375 -3.40625 2.5 -3.40625 C 2.882812 -3.40625 3.195312 -3.28125 3.4375 -3.03125 C 3.6875 -2.78125 3.8125 -2.429688 3.8125 -1.984375 C 3.8125 -1.597656 3.726562 -1.242188 3.5625 -0.921875 C 3.394531 -0.597656 3.160156 -0.347656 2.859375 -0.171875 C 2.566406 -0.00390625 2.25 0.078125 1.90625 0.078125 C 1.625 0.078125 1.367188 0.015625 1.140625 -0.109375 C 0.921875 -0.234375 0.753906 -0.410156 0.640625 -0.640625 C 0.535156 -0.867188 0.484375 -1.097656 0.484375 -1.328125 C 0.484375 -1.347656 0.484375 -1.382812 0.484375 -1.4375 Z M 0.484375 -1.4375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-0\" overflow=\"visible\">\n",
       "<path d=\"M 1.125 0 L 1.125 -5.625 L 5.625 -5.625 L 5.625 0 Z M 1.265625 -0.140625 L 5.484375 -0.140625 L 5.484375 -5.484375 L 1.265625 -5.484375 Z M 1.265625 -0.140625 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-1\" overflow=\"visible\">\n",
       "<path d=\"M 0.84375 0 L 0.84375 -6.4375 L 1.6875 -6.4375 L 1.6875 0 Z M 0.84375 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-2\" overflow=\"visible\">\n",
       "<path d=\"M 0.59375 0 L 0.59375 -4.671875 L 1.3125 -4.671875 L 1.3125 -4 C 1.644531 -4.507812 2.140625 -4.765625 2.796875 -4.765625 C 3.078125 -4.765625 3.332031 -4.710938 3.5625 -4.609375 C 3.800781 -4.515625 3.976562 -4.382812 4.09375 -4.21875 C 4.207031 -4.0625 4.289062 -3.867188 4.34375 -3.640625 C 4.375 -3.492188 4.390625 -3.238281 4.390625 -2.875 L 4.390625 0 L 3.59375 0 L 3.59375 -2.84375 C 3.59375 -3.164062 3.5625 -3.40625 3.5 -3.5625 C 3.4375 -3.71875 3.328125 -3.84375 3.171875 -3.9375 C 3.015625 -4.039062 2.832031 -4.09375 2.625 -4.09375 C 2.289062 -4.09375 2 -3.984375 1.75 -3.765625 C 1.507812 -3.554688 1.390625 -3.148438 1.390625 -2.546875 L 1.390625 0 Z M 0.59375 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-3\" overflow=\"visible\">\n",
       "<path d=\"M 0.59375 1.78125 L 0.59375 -4.671875 L 1.3125 -4.671875 L 1.3125 -4.0625 C 1.476562 -4.300781 1.664062 -4.476562 1.875 -4.59375 C 2.09375 -4.707031 2.359375 -4.765625 2.671875 -4.765625 C 3.066406 -4.765625 3.414062 -4.660156 3.71875 -4.453125 C 4.019531 -4.253906 4.25 -3.96875 4.40625 -3.59375 C 4.5625 -3.21875 4.640625 -2.8125 4.640625 -2.375 C 4.640625 -1.894531 4.550781 -1.460938 4.375 -1.078125 C 4.207031 -0.691406 3.960938 -0.394531 3.640625 -0.1875 C 3.316406 0.0078125 2.972656 0.109375 2.609375 0.109375 C 2.347656 0.109375 2.113281 0.0507812 1.90625 -0.0625 C 1.695312 -0.175781 1.523438 -0.316406 1.390625 -0.484375 L 1.390625 1.78125 Z M 1.3125 -2.3125 C 1.3125 -1.707031 1.429688 -1.257812 1.671875 -0.96875 C 1.921875 -0.6875 2.21875 -0.546875 2.5625 -0.546875 C 2.90625 -0.546875 3.203125 -0.691406 3.453125 -0.984375 C 3.710938 -1.285156 3.84375 -1.75 3.84375 -2.375 C 3.84375 -2.96875 3.71875 -3.410156 3.46875 -3.703125 C 3.226562 -4.003906 2.9375 -4.15625 2.59375 -4.15625 C 2.257812 -4.15625 1.960938 -3.992188 1.703125 -3.671875 C 1.441406 -3.359375 1.3125 -2.90625 1.3125 -2.3125 Z M 1.3125 -2.3125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-4\" overflow=\"visible\">\n",
       "<path d=\"M 3.65625 0 L 3.65625 -0.6875 C 3.289062 -0.15625 2.796875 0.109375 2.171875 0.109375 C 1.898438 0.109375 1.644531 0.0546875 1.40625 -0.046875 C 1.164062 -0.160156 0.984375 -0.296875 0.859375 -0.453125 C 0.742188 -0.609375 0.664062 -0.800781 0.625 -1.03125 C 0.59375 -1.1875 0.578125 -1.4375 0.578125 -1.78125 L 0.578125 -4.671875 L 1.359375 -4.671875 L 1.359375 -2.078125 C 1.359375 -1.660156 1.378906 -1.382812 1.421875 -1.25 C 1.460938 -1.039062 1.5625 -0.875 1.71875 -0.75 C 1.882812 -0.632812 2.085938 -0.578125 2.328125 -0.578125 C 2.566406 -0.578125 2.789062 -0.632812 3 -0.75 C 3.207031 -0.875 3.351562 -1.039062 3.4375 -1.25 C 3.519531 -1.457031 3.5625 -1.765625 3.5625 -2.171875 L 3.5625 -4.671875 L 4.359375 -4.671875 L 4.359375 0 Z M 3.65625 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-5\" overflow=\"visible\">\n",
       "<path d=\"M 2.328125 -0.703125 L 2.4375 -0.015625 C 2.207031 0.0351562 2.007812 0.0625 1.84375 0.0625 C 1.550781 0.0625 1.328125 0.015625 1.171875 -0.078125 C 1.015625 -0.171875 0.898438 -0.289062 0.828125 -0.4375 C 0.765625 -0.582031 0.734375 -0.890625 0.734375 -1.359375 L 0.734375 -4.046875 L 0.15625 -4.046875 L 0.15625 -4.671875 L 0.734375 -4.671875 L 0.734375 -5.828125 L 1.53125 -6.296875 L 1.53125 -4.671875 L 2.328125 -4.671875 L 2.328125 -4.046875 L 1.53125 -4.046875 L 1.53125 -1.328125 C 1.53125 -1.097656 1.539062 -0.953125 1.5625 -0.890625 C 1.59375 -0.828125 1.640625 -0.773438 1.703125 -0.734375 C 1.765625 -0.691406 1.851562 -0.671875 1.96875 -0.671875 C 2.0625 -0.671875 2.179688 -0.679688 2.328125 -0.703125 Z M 2.328125 -0.703125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-6\" overflow=\"visible\">\n",
       "<path d=\"\" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-7\" overflow=\"visible\">\n",
       "<path d=\"M 0.578125 0 L 0.578125 -6.4375 L 1.359375 -6.4375 L 1.359375 0 Z M 0.578125 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-8\" overflow=\"visible\">\n",
       "<path d=\"M 3.640625 -0.578125 C 3.347656 -0.328125 3.066406 -0.148438 2.796875 -0.046875 C 2.523438 0.0546875 2.234375 0.109375 1.921875 0.109375 C 1.410156 0.109375 1.015625 -0.015625 0.734375 -0.265625 C 0.460938 -0.515625 0.328125 -0.835938 0.328125 -1.234375 C 0.328125 -1.460938 0.378906 -1.671875 0.484375 -1.859375 C 0.585938 -2.046875 0.722656 -2.195312 0.890625 -2.3125 C 1.054688 -2.425781 1.242188 -2.515625 1.453125 -2.578125 C 1.609375 -2.609375 1.84375 -2.644531 2.15625 -2.6875 C 2.800781 -2.757812 3.273438 -2.851562 3.578125 -2.96875 C 3.578125 -3.070312 3.578125 -3.140625 3.578125 -3.171875 C 3.578125 -3.492188 3.503906 -3.71875 3.359375 -3.84375 C 3.148438 -4.03125 2.847656 -4.125 2.453125 -4.125 C 2.078125 -4.125 1.800781 -4.054688 1.625 -3.921875 C 1.445312 -3.796875 1.316406 -3.566406 1.234375 -3.234375 L 0.46875 -3.328125 C 0.53125 -3.660156 0.640625 -3.925781 0.796875 -4.125 C 0.960938 -4.332031 1.195312 -4.488281 1.5 -4.59375 C 1.8125 -4.707031 2.164062 -4.765625 2.5625 -4.765625 C 2.96875 -4.765625 3.289062 -4.71875 3.53125 -4.625 C 3.78125 -4.53125 3.960938 -4.410156 4.078125 -4.265625 C 4.203125 -4.128906 4.285156 -3.953125 4.328125 -3.734375 C 4.359375 -3.597656 4.375 -3.359375 4.375 -3.015625 L 4.375 -1.953125 C 4.375 -1.222656 4.390625 -0.757812 4.421875 -0.5625 C 4.453125 -0.363281 4.519531 -0.175781 4.625 0 L 3.796875 0 C 3.710938 -0.164062 3.660156 -0.359375 3.640625 -0.578125 Z M 3.578125 -2.34375 C 3.285156 -2.226562 2.851562 -2.128906 2.28125 -2.046875 C 1.957031 -1.992188 1.726562 -1.9375 1.59375 -1.875 C 1.457031 -1.820312 1.351562 -1.738281 1.28125 -1.625 C 1.207031 -1.507812 1.171875 -1.382812 1.171875 -1.25 C 1.171875 -1.039062 1.25 -0.863281 1.40625 -0.71875 C 1.5625 -0.582031 1.796875 -0.515625 2.109375 -0.515625 C 2.410156 -0.515625 2.679688 -0.582031 2.921875 -0.71875 C 3.160156 -0.851562 3.335938 -1.035156 3.453125 -1.265625 C 3.535156 -1.441406 3.578125 -1.703125 3.578125 -2.046875 Z M 3.578125 -2.34375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-9\" overflow=\"visible\">\n",
       "<path d=\"M 0.5625 1.796875 L 0.46875 1.0625 C 0.644531 1.101562 0.796875 1.125 0.921875 1.125 C 1.097656 1.125 1.238281 1.09375 1.34375 1.03125 C 1.445312 0.976562 1.535156 0.898438 1.609375 0.796875 C 1.648438 0.710938 1.726562 0.515625 1.84375 0.203125 C 1.863281 0.160156 1.890625 0.0976562 1.921875 0.015625 L 0.140625 -4.671875 L 1 -4.671875 L 1.96875 -1.96875 C 2.09375 -1.625 2.207031 -1.265625 2.3125 -0.890625 C 2.394531 -1.242188 2.5 -1.597656 2.625 -1.953125 L 3.625 -4.671875 L 4.421875 -4.671875 L 2.640625 0.078125 C 2.453125 0.585938 2.304688 0.941406 2.203125 1.140625 C 2.054688 1.398438 1.894531 1.585938 1.71875 1.703125 C 1.539062 1.828125 1.320312 1.890625 1.0625 1.890625 C 0.914062 1.890625 0.75 1.859375 0.5625 1.796875 Z M 0.5625 1.796875 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-10\" overflow=\"visible\">\n",
       "<path d=\"M 3.78125 -1.5 L 4.609375 -1.40625 C 4.472656 -0.925781 4.226562 -0.550781 3.875 -0.28125 C 3.53125 -0.0195312 3.085938 0.109375 2.546875 0.109375 C 1.867188 0.109375 1.328125 -0.0976562 0.921875 -0.515625 C 0.523438 -0.941406 0.328125 -1.535156 0.328125 -2.296875 C 0.328125 -3.078125 0.53125 -3.679688 0.9375 -4.109375 C 1.34375 -4.546875 1.867188 -4.765625 2.515625 -4.765625 C 3.140625 -4.765625 3.644531 -4.550781 4.03125 -4.125 C 4.425781 -3.707031 4.625 -3.113281 4.625 -2.34375 C 4.625 -2.289062 4.625 -2.21875 4.625 -2.125 L 1.140625 -2.125 C 1.171875 -1.613281 1.316406 -1.222656 1.578125 -0.953125 C 1.835938 -0.679688 2.164062 -0.546875 2.5625 -0.546875 C 2.851562 -0.546875 3.097656 -0.617188 3.296875 -0.765625 C 3.503906 -0.921875 3.664062 -1.164062 3.78125 -1.5 Z M 1.1875 -2.78125 L 3.796875 -2.78125 C 3.765625 -3.175781 3.664062 -3.472656 3.5 -3.671875 C 3.25 -3.972656 2.921875 -4.125 2.515625 -4.125 C 2.148438 -4.125 1.84375 -4 1.59375 -3.75 C 1.351562 -3.507812 1.21875 -3.1875 1.1875 -2.78125 Z M 1.1875 -2.78125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-11\" overflow=\"visible\">\n",
       "<path d=\"M 0.578125 0 L 0.578125 -4.671875 L 1.296875 -4.671875 L 1.296875 -3.953125 C 1.472656 -4.285156 1.640625 -4.503906 1.796875 -4.609375 C 1.953125 -4.710938 2.125 -4.765625 2.3125 -4.765625 C 2.570312 -4.765625 2.84375 -4.679688 3.125 -4.515625 L 2.84375 -3.78125 C 2.65625 -3.894531 2.460938 -3.953125 2.265625 -3.953125 C 2.097656 -3.953125 1.941406 -3.898438 1.796875 -3.796875 C 1.660156 -3.691406 1.5625 -3.546875 1.5 -3.359375 C 1.414062 -3.078125 1.375 -2.769531 1.375 -2.4375 L 1.375 0 Z M 0.578125 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-12\" overflow=\"visible\">\n",
       "<path d=\"M 0.4375 -3.140625 C 0.4375 -4.203125 0.722656 -5.035156 1.296875 -5.640625 C 1.867188 -6.253906 2.609375 -6.5625 3.515625 -6.5625 C 4.109375 -6.5625 4.644531 -6.414062 5.125 -6.125 C 5.601562 -5.84375 5.96875 -5.445312 6.21875 -4.9375 C 6.46875 -4.425781 6.59375 -3.851562 6.59375 -3.21875 C 6.59375 -2.5625 6.460938 -1.972656 6.203125 -1.453125 C 5.941406 -0.941406 5.566406 -0.550781 5.078125 -0.28125 C 4.597656 -0.0195312 4.078125 0.109375 3.515625 0.109375 C 2.910156 0.109375 2.367188 -0.0351562 1.890625 -0.328125 C 1.410156 -0.617188 1.046875 -1.019531 0.796875 -1.53125 C 0.554688 -2.039062 0.4375 -2.578125 0.4375 -3.140625 Z M 1.3125 -3.125 C 1.3125 -2.34375 1.519531 -1.726562 1.9375 -1.28125 C 2.351562 -0.84375 2.878906 -0.625 3.515625 -0.625 C 4.148438 -0.625 4.675781 -0.847656 5.09375 -1.296875 C 5.507812 -1.742188 5.71875 -2.382812 5.71875 -3.21875 C 5.71875 -3.738281 5.628906 -4.191406 5.453125 -4.578125 C 5.273438 -4.972656 5.015625 -5.28125 4.671875 -5.5 C 4.328125 -5.71875 3.945312 -5.828125 3.53125 -5.828125 C 2.925781 -5.828125 2.40625 -5.617188 1.96875 -5.203125 C 1.53125 -4.785156 1.3125 -4.09375 1.3125 -3.125 Z M 1.3125 -3.125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path d=\"M 124.015625 139.234375 C 128.996094 144.214844 128.996094 152.285156 124.015625 157.265625 C 119.035156 162.246094 110.964844 162.246094 105.984375 157.265625 C 101.003906 152.285156 101.003906 144.214844 105.984375 139.234375 C 110.964844 134.253906 119.035156 134.253906 124.015625 139.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.804382%,85.098267%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"86.803467\" xlink:href=\"#glyph0-1\" y=\"76.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"91.303467\" xlink:href=\"#glyph1-1\" y=\"78.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 176.890625 139.234375 C 181.871094 144.214844 181.871094 152.285156 176.890625 157.265625 C 171.910156 162.246094 163.839844 162.246094 158.859375 157.265625 C 153.878906 152.285156 153.878906 144.214844 158.859375 139.234375 C 163.839844 134.253906 171.910156 134.253906 176.890625 139.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.804382%,85.098267%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"139.678467\" xlink:href=\"#glyph0-1\" y=\"76.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"144.178467\" xlink:href=\"#glyph1-2\" y=\"78.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 157.015625 78.234375 C 161.996094 83.214844 161.996094 91.285156 157.015625 96.265625 C 152.035156 101.246094 143.964844 101.246094 138.984375 96.265625 C 134.003906 91.285156 134.003906 83.214844 138.984375 78.234375 C 143.964844 73.253906 152.035156 73.253906 157.015625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.902344%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"119.550781\" xlink:href=\"#glyph0-2\" y=\"15.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"124.556152\" xlink:href=\"#glyph1-2\" y=\"17.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"8.98755\" xlink:href=\"#glyph2-1\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"11.48775\" xlink:href=\"#glyph2-2\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"16.49355\" xlink:href=\"#glyph2-3\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"21.49935\" xlink:href=\"#glyph2-4\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"26.50515\" xlink:href=\"#glyph2-5\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"29.00535\" xlink:href=\"#glyph2-6\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"31.50555\" xlink:href=\"#glyph2-7\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"33.50535\" xlink:href=\"#glyph2-8\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"38.51115\" xlink:href=\"#glyph2-9\" y=\"76.352783\"/>\n",
       "  <use x=\"43.01115\" xlink:href=\"#glyph2-10\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"48.01695\" xlink:href=\"#glyph2-11\" y=\"76.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"5.4873\" xlink:href=\"#glyph2-12\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"12.4875\" xlink:href=\"#glyph2-4\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"17.4933\" xlink:href=\"#glyph2-5\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"19.9935\" xlink:href=\"#glyph2-3\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"24.9993\" xlink:href=\"#glyph2-4\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"30.0051\" xlink:href=\"#glyph2-5\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"32.5053\" xlink:href=\"#glyph2-6\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"35.0055\" xlink:href=\"#glyph2-7\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"37.0053\" xlink:href=\"#glyph2-8\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"42.0111\" xlink:href=\"#glyph2-9\" y=\"16.102783\"/>\n",
       "  <use x=\"46.5111\" xlink:href=\"#glyph2-10\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"51.5169\" xlink:href=\"#glyph2-11\" y=\"16.102783\"/>\n",
       "</g>\n",
       "<path d=\"M 229.765625 139.234375 C 234.746094 144.214844 234.746094 152.285156 229.765625 157.265625 C 224.785156 162.246094 216.714844 162.246094 211.734375 157.265625 C 206.753906 152.285156 206.753906 144.214844 211.734375 139.234375 C 216.714844 134.253906 224.785156 134.253906 229.765625 139.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.804382%,85.098267%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"192.553467\" xlink:href=\"#glyph0-1\" y=\"76.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"197.053467\" xlink:href=\"#glyph1-3\" y=\"78.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 282.640625 138.484375 C 287.621094 143.464844 287.621094 151.535156 282.640625 156.515625 C 277.660156 161.496094 269.589844 161.496094 264.609375 156.515625 C 259.628906 151.535156 259.628906 143.464844 264.609375 138.484375 C 269.589844 133.503906 277.660156 133.503906 282.640625 138.484375 \" style=\"fill-rule:nonzero;fill:rgb(69.804382%,85.098267%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"245.428467\" xlink:href=\"#glyph0-1\" y=\"75.885498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"249.928467\" xlink:href=\"#glyph1-4\" y=\"77.885498\"/>\n",
       "</g>\n",
       "<path d=\"M 248.265625 78.234375 C 253.246094 83.214844 253.246094 91.285156 248.265625 96.265625 C 243.285156 101.246094 235.214844 101.246094 230.234375 96.265625 C 225.253906 91.285156 225.253906 83.214844 230.234375 78.234375 C 235.214844 73.253906 243.285156 73.253906 248.265625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.902344%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"210.800781\" xlink:href=\"#glyph0-2\" y=\"15.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"215.806152\" xlink:href=\"#glyph1-4\" y=\"17.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 202.640625 78.234375 C 207.621094 83.214844 207.621094 91.285156 202.640625 96.265625 C 197.660156 101.246094 189.589844 101.246094 184.609375 96.265625 C 179.628906 91.285156 179.628906 83.214844 184.609375 78.234375 C 189.589844 73.253906 197.660156 73.253906 202.640625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.902344%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"165.175781\" xlink:href=\"#glyph0-2\" y=\"15.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"170.181152\" xlink:href=\"#glyph1-3\" y=\"17.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 111.390625 78.234375 C 116.371094 83.214844 116.371094 91.285156 111.390625 96.265625 C 106.410156 101.246094 98.339844 101.246094 93.359375 96.265625 C 88.378906 91.285156 88.378906 83.214844 93.359375 78.234375 C 98.339844 73.253906 106.410156 73.253906 111.390625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.902344%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"73.925781\" xlink:href=\"#glyph0-2\" y=\"15.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"78.931152\" xlink:href=\"#glyph1-1\" y=\"17.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 293.890625 78.234375 C 298.871094 83.214844 298.871094 91.285156 293.890625 96.265625 C 288.910156 101.246094 280.839844 101.246094 275.859375 96.265625 C 270.878906 91.285156 270.878906 83.214844 275.859375 78.234375 C 280.839844 73.253906 288.910156 73.253906 293.890625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.902344%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"256.425781\" xlink:href=\"#glyph0-2\" y=\"15.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"261.431152\" xlink:href=\"#glyph1-5\" y=\"17.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 112.414062 135.761719 L 106.15625 105.515625 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 105.34375 101.597656 L 106.15625 105.515625 M 104.6875 105.820312 L 105.34375 101.597656 L 107.625 105.210938 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 121.066406 137.03125 L 139.125 103.65625 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 141.027344 100.136719 L 139.125 103.65625 M 137.804688 102.941406 L 141.027344 100.136719 L 140.445312 104.371094 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 125.074219 140.433594 L 178.890625 98.683594 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 182.050781 96.230469 L 178.890625 98.683594 M 177.96875 97.496094 L 182.050781 96.230469 L 179.808594 99.867188 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 126.449219 142.628906 L 222.503906 95.46875 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 226.097656 93.707031 L 222.503906 95.46875 M 221.84375 94.125 L 226.097656 93.707031 L 223.167969 96.816406 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 127.003906 143.941406 L 267.320312 93.554688 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 271.085938 92.203125 L 267.320312 93.554688 M 266.8125 92.140625 L 271.085938 92.203125 L 267.828125 94.964844 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 158.542969 139.558594 L 116.023438 99.960938 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 113.097656 97.234375 L 116.023438 99.960938 M 115 101.058594 L 113.097656 97.234375 L 117.046875 98.863281 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 163.925781 136.125 L 153.777344 104.984375 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 152.539062 101.183594 L 153.777344 104.984375 M 152.351562 105.449219 L 152.539062 101.183594 L 155.203125 104.519531 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 172.835938 136.5 L 186.371094 104.433594 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 187.925781 100.75 L 186.371094 104.433594 M 184.988281 103.851562 L 187.925781 100.75 L 187.753906 105.019531 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 177.566406 139.964844 L 225.070312 99.367188 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 228.113281 96.769531 L 225.070312 99.367188 M 224.097656 98.226562 L 228.113281 96.769531 L 226.046875 100.507812 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 179.183594 142.355469 L 268.335938 95.875 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 271.882812 94.023438 L 268.335938 95.875 M 267.640625 94.542969 L 271.882812 94.023438 L 269.027344 97.203125 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 209.414062 142.40625 L 118.957031 95.792969 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 115.402344 93.960938 L 118.957031 95.792969 M 118.269531 97.128906 L 115.402344 93.960938 L 119.644531 94.460938 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 210.980469 140.058594 L 162.292969 99.234375 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 159.226562 96.664062 L 162.292969 99.234375 M 161.328125 100.382812 L 159.226562 96.664062 L 163.253906 98.082031 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 215.566406 136.597656 L 201.203125 104.292969 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 199.578125 100.640625 L 201.203125 104.292969 M 199.832031 104.902344 L 199.578125 100.640625 L 202.574219 103.683594 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 224.449219 136.046875 L 233.835938 105.101562 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 234.996094 101.273438 L 233.835938 105.101562 M 232.402344 104.664062 L 234.996094 101.273438 L 235.273438 105.535156 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 229.988281 139.460938 L 271.363281 100.105469 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 274.261719 97.347656 L 271.363281 100.105469 M 270.328125 99.015625 L 274.261719 97.347656 L 272.394531 101.191406 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 261.59375 143.265625 L 119.96875 93.441406 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 116.199219 92.113281 L 119.96875 93.441406 M 119.472656 94.855469 L 116.199219 92.113281 L 120.46875 92.027344 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 262.125 141.984375 L 164.820312 95.316406 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 161.210938 93.585938 L 164.820312 95.316406 M 164.171875 96.667969 L 161.210938 93.585938 L 165.46875 93.964844 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 263.4375 139.828125 L 208.523438 98.472656 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 205.328125 96.0625 L 208.523438 98.472656 M 207.621094 99.667969 L 205.328125 96.0625 L 209.425781 97.273438 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 267.304688 136.421875 L 248.492188 103.453125 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 246.511719 99.976562 L 248.492188 103.453125 M 247.191406 104.195312 L 246.511719 99.976562 L 249.796875 102.707031 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 275.964844 134.964844 L 281.453125 105.585938 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "<path d=\"M 282.1875 101.652344 L 281.453125 105.585938 M 279.976562 105.308594 L 282.1875 101.652344 L 282.925781 105.859375 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-24,-74)\"/>\n",
       "</g>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import SVG\n",
    "SVG(filename='../img/singlelayer.svg')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If our labels really were related to our input data\n",
    "by an approximately linear function, then this approach would be perfect.\n",
    "But linearity is a *strong assumption*.\n",
    "Linearity implies that for whatever target value we are trying to predict,\n",
    "increasing the value of each of our inputs\n",
    "should either drive the value of the output up or drive it down,\n",
    "irrespective of the value of the other inputs.\n",
    "\n",
    "Sometimes this makes sense!\n",
    "Say we are trying to predict whether an individual\n",
    "will or will not repay a loan.\n",
    "We might reasonably imagine that all else being equal,\n",
    "an applicant with a higher income\n",
    "would be more likely to repay than one with a lower income.\n",
    "In these cases, linear models might perform well,\n",
    "and they might even be hard to beat.\n",
    "\n",
    "But what about classifying images in FashionMNIST?\n",
    "Should increasing the intensity of the pixel at location (13,17)\n",
    "always increase the likelihood that the image depicts a pocketbook?\n",
    "That seems ridiculous because we all know\n",
    "that you cannot make sense out of an image\n",
    "without accounting for the interactions among pixels.\n",
    "\n",
    "\n",
    "\n",
    "### From one to many\n",
    "\n",
    "As another case, consider trying to classify images\n",
    "based on whether they depict *cats* or *dogs* given black-and-white images.\n",
    "\n",
    "If we use a linear model, we'd basically be saying that\n",
    "for each pixel, increasing its value (making it more white)\n",
    "must always increase the probability that the image depicts a dog\n",
    "or must always increase the probability that the image depicts a cat.\n",
    "We would be making the absurd assumption that the only requirement\n",
    "for differentiating cats vs. dogs is to assess how bright they are.\n",
    "That approach is doomed to fail in a work\n",
    "that contains both black dogs and black cats,\n",
    "and both white dogs and white cats.\n",
    "\n",
    "Teasing out what is depicted in an image generally requires\n",
    "allowing more complex relationships between our inputs and outputs.\n",
    "Thus we need models capable of discovering patterns\n",
    "that might be characterized by interactions among the many features.\n",
    "We can over come these limitations of linear models\n",
    "and handle a more general class of functions\n",
    "by incorporating one or more hidden layers.\n",
    "The easiest way to do this is to stack\n",
    "many layers of neurons on top of each other.\n",
    "Each layer feeds into the layer above it, until we generate an output.\n",
    "This architecture is commonly called a *multilayer perceptron*,\n",
    "often abbreviated as *MLP*.\n",
    "The neural network diagram for an MLP looks like this:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg height=\"150pt\" version=\"1.1\" viewBox=\"0 0 276 150\" width=\"276pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol id=\"glyph0-0\" overflow=\"visible\">\n",
       "<path d=\"M 1.125 0 L 1.125 -5.625 L 5.625 -5.625 L 5.625 0 Z M 1.265625 -0.140625 L 5.484375 -0.140625 L 5.484375 -5.484375 L 1.265625 -5.484375 Z M 1.265625 -0.140625 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph0-1\" overflow=\"visible\">\n",
       "<path d=\"M -0.015625 0 L 2.015625 -2.375 L 0.859375 -4.671875 L 1.734375 -4.671875 L 2.125 -3.84375 C 2.269531 -3.53125 2.398438 -3.226562 2.515625 -2.9375 L 3.875 -4.671875 L 4.84375 -4.671875 L 2.875 -2.3125 L 4.0625 0 L 3.171875 0 L 2.71875 -0.953125 C 2.613281 -1.148438 2.5 -1.398438 2.375 -1.703125 L 0.984375 0 Z M -0.015625 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph0-2\" overflow=\"visible\">\n",
       "<path d=\"M 0.296875 0 L 1.640625 -6.4375 L 2.4375 -6.4375 L 1.921875 -3.96875 C 2.222656 -4.257812 2.5 -4.460938 2.75 -4.578125 C 3.007812 -4.703125 3.269531 -4.765625 3.53125 -4.765625 C 3.925781 -4.765625 4.226562 -4.660156 4.4375 -4.453125 C 4.65625 -4.253906 4.765625 -3.988281 4.765625 -3.65625 C 4.765625 -3.5 4.71875 -3.195312 4.625 -2.75 L 4.046875 0 L 3.25 0 L 3.84375 -2.828125 C 3.925781 -3.234375 3.96875 -3.488281 3.96875 -3.59375 C 3.96875 -3.75 3.914062 -3.875 3.8125 -3.96875 C 3.707031 -4.070312 3.554688 -4.125 3.359375 -4.125 C 3.066406 -4.125 2.789062 -4.046875 2.53125 -3.890625 C 2.269531 -3.742188 2.066406 -3.535156 1.921875 -3.265625 C 1.773438 -3.003906 1.640625 -2.582031 1.515625 -2 L 1.09375 0 Z M 0.296875 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph0-3\" overflow=\"visible\">\n",
       "<path d=\"M 0.4375 -1.765625 C 0.4375 -2.679688 0.707031 -3.4375 1.25 -4.03125 C 1.6875 -4.519531 2.265625 -4.765625 2.984375 -4.765625 C 3.546875 -4.765625 4 -4.585938 4.34375 -4.234375 C 4.6875 -3.890625 4.859375 -3.421875 4.859375 -2.828125 C 4.859375 -2.285156 4.75 -1.785156 4.53125 -1.328125 C 4.3125 -0.867188 4.003906 -0.515625 3.609375 -0.265625 C 3.210938 -0.015625 2.789062 0.109375 2.34375 0.109375 C 1.976562 0.109375 1.644531 0.03125 1.34375 -0.125 C 1.050781 -0.28125 0.828125 -0.5 0.671875 -0.78125 C 0.515625 -1.070312 0.4375 -1.398438 0.4375 -1.765625 Z M 1.234375 -1.84375 C 1.234375 -1.40625 1.335938 -1.070312 1.546875 -0.84375 C 1.765625 -0.625 2.035156 -0.515625 2.359375 -0.515625 C 2.523438 -0.515625 2.691406 -0.546875 2.859375 -0.609375 C 3.023438 -0.679688 3.179688 -0.785156 3.328125 -0.921875 C 3.472656 -1.066406 3.59375 -1.226562 3.6875 -1.40625 C 3.789062 -1.582031 3.875 -1.773438 3.9375 -1.984375 C 4.03125 -2.273438 4.078125 -2.554688 4.078125 -2.828125 C 4.078125 -3.242188 3.96875 -3.566406 3.75 -3.796875 C 3.539062 -4.035156 3.273438 -4.15625 2.953125 -4.15625 C 2.703125 -4.15625 2.472656 -4.09375 2.265625 -3.96875 C 2.066406 -3.851562 1.882812 -3.679688 1.71875 -3.453125 C 1.550781 -3.222656 1.425781 -2.957031 1.34375 -2.65625 C 1.269531 -2.351562 1.234375 -2.082031 1.234375 -1.84375 Z M 1.234375 -1.84375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-0\" overflow=\"visible\">\n",
       "<path d=\"M 0.875 0 L 0.875 -4.375 L 4.375 -4.375 L 4.375 0 Z M 0.984375 -0.109375 L 4.265625 -0.109375 L 4.265625 -4.265625 L 0.984375 -4.265625 Z M 0.984375 -0.109375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-1\" overflow=\"visible\">\n",
       "<path d=\"M 1.6875 0 L 2.484375 -3.78125 C 2.140625 -3.507812 1.65625 -3.296875 1.03125 -3.140625 L 1.15625 -3.703125 C 1.457031 -3.828125 1.757812 -3.988281 2.0625 -4.1875 C 2.363281 -4.382812 2.585938 -4.554688 2.734375 -4.703125 C 2.828125 -4.796875 2.914062 -4.90625 3 -5.03125 L 3.359375 -5.03125 L 2.3125 0 Z M 1.6875 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-2\" overflow=\"visible\">\n",
       "<path d=\"M 0.40625 0 C 0.46875 -0.300781 0.554688 -0.550781 0.671875 -0.75 C 0.785156 -0.945312 0.9375 -1.132812 1.125 -1.3125 C 1.3125 -1.5 1.671875 -1.804688 2.203125 -2.234375 C 2.523438 -2.492188 2.75 -2.6875 2.875 -2.8125 C 3.039062 -2.988281 3.160156 -3.160156 3.234375 -3.328125 C 3.285156 -3.441406 3.3125 -3.566406 3.3125 -3.703125 C 3.3125 -3.929688 3.226562 -4.125 3.0625 -4.28125 C 2.90625 -4.445312 2.707031 -4.53125 2.46875 -4.53125 C 2.238281 -4.53125 2.035156 -4.445312 1.859375 -4.28125 C 1.679688 -4.125 1.554688 -3.863281 1.484375 -3.5 L 0.875 -3.59375 C 0.9375 -4.039062 1.109375 -4.390625 1.390625 -4.640625 C 1.679688 -4.898438 2.039062 -5.03125 2.46875 -5.03125 C 2.75 -5.03125 3.003906 -4.96875 3.234375 -4.84375 C 3.460938 -4.726562 3.632812 -4.5625 3.75 -4.34375 C 3.875 -4.132812 3.9375 -3.914062 3.9375 -3.6875 C 3.9375 -3.351562 3.816406 -3.035156 3.578125 -2.734375 C 3.429688 -2.535156 3.003906 -2.15625 2.296875 -1.59375 C 1.984375 -1.351562 1.753906 -1.15625 1.609375 -1 C 1.460938 -0.84375 1.351562 -0.695312 1.28125 -0.5625 L 3.515625 -0.5625 L 3.390625 0 Z M 0.40625 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-3\" overflow=\"visible\">\n",
       "<path d=\"M 0.390625 -1.3125 L 0.984375 -1.390625 C 1.023438 -1.035156 1.125 -0.78125 1.28125 -0.625 C 1.4375 -0.476562 1.644531 -0.40625 1.90625 -0.40625 C 2.207031 -0.40625 2.46875 -0.515625 2.6875 -0.734375 C 2.914062 -0.953125 3.03125 -1.203125 3.03125 -1.484375 C 3.03125 -1.734375 2.945312 -1.9375 2.78125 -2.09375 C 2.613281 -2.257812 2.390625 -2.34375 2.109375 -2.34375 C 2.078125 -2.34375 2.007812 -2.335938 1.90625 -2.328125 L 2.015625 -2.84375 C 2.078125 -2.832031 2.132812 -2.828125 2.1875 -2.828125 C 2.539062 -2.828125 2.8125 -2.910156 3 -3.078125 C 3.1875 -3.253906 3.28125 -3.46875 3.28125 -3.71875 C 3.28125 -3.945312 3.203125 -4.140625 3.046875 -4.296875 C 2.890625 -4.453125 2.703125 -4.53125 2.484375 -4.53125 C 2.253906 -4.53125 2.050781 -4.445312 1.875 -4.28125 C 1.695312 -4.125 1.585938 -3.898438 1.546875 -3.609375 L 0.9375 -3.734375 C 1.03125 -4.148438 1.21875 -4.46875 1.5 -4.6875 C 1.789062 -4.914062 2.128906 -5.03125 2.515625 -5.03125 C 2.929688 -5.03125 3.265625 -4.90625 3.515625 -4.65625 C 3.773438 -4.40625 3.90625 -4.101562 3.90625 -3.75 C 3.90625 -3.476562 3.832031 -3.242188 3.6875 -3.046875 C 3.550781 -2.847656 3.347656 -2.6875 3.078125 -2.5625 C 3.265625 -2.445312 3.40625 -2.304688 3.5 -2.140625 C 3.601562 -1.972656 3.65625 -1.785156 3.65625 -1.578125 C 3.65625 -1.128906 3.488281 -0.738281 3.15625 -0.40625 C 2.820312 -0.0820312 2.421875 0.078125 1.953125 0.078125 C 1.492188 0.078125 1.125 -0.046875 0.84375 -0.296875 C 0.570312 -0.546875 0.421875 -0.882812 0.390625 -1.3125 Z M 0.390625 -1.3125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-4\" overflow=\"visible\">\n",
       "<path d=\"M 2.09375 0 L 2.359375 -1.28125 L 0.3125 -1.28125 L 0.453125 -1.890625 L 3.25 -5.015625 L 3.765625 -5.015625 L 3.09375 -1.828125 L 3.796875 -1.828125 L 3.6875 -1.28125 L 2.984375 -1.28125 L 2.703125 0 Z M 2.46875 -1.828125 L 2.90625 -3.921875 L 1.046875 -1.828125 Z M 2.46875 -1.828125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph1-5\" overflow=\"visible\">\n",
       "<path d=\"M 0.484375 -1.4375 L 1.125 -1.5 C 1.113281 -1.40625 1.109375 -1.347656 1.109375 -1.328125 C 1.109375 -1.179688 1.144531 -1.03125 1.21875 -0.875 C 1.300781 -0.726562 1.40625 -0.613281 1.53125 -0.53125 C 1.664062 -0.445312 1.804688 -0.40625 1.953125 -0.40625 C 2.140625 -0.40625 2.332031 -0.46875 2.53125 -0.59375 C 2.726562 -0.726562 2.890625 -0.921875 3.015625 -1.171875 C 3.140625 -1.429688 3.203125 -1.6875 3.203125 -1.9375 C 3.203125 -2.21875 3.117188 -2.441406 2.953125 -2.609375 C 2.785156 -2.773438 2.566406 -2.859375 2.296875 -2.859375 C 2.117188 -2.859375 1.945312 -2.8125 1.78125 -2.71875 C 1.625 -2.632812 1.476562 -2.507812 1.34375 -2.34375 L 0.796875 -2.375 L 1.5625 -4.9375 L 4 -4.9375 L 3.890625 -4.375 L 1.984375 -4.375 L 1.609375 -3.09375 C 1.742188 -3.195312 1.882812 -3.273438 2.03125 -3.328125 C 2.1875 -3.378906 2.34375 -3.40625 2.5 -3.40625 C 2.882812 -3.40625 3.195312 -3.28125 3.4375 -3.03125 C 3.6875 -2.78125 3.8125 -2.429688 3.8125 -1.984375 C 3.8125 -1.597656 3.726562 -1.242188 3.5625 -0.921875 C 3.394531 -0.597656 3.160156 -0.347656 2.859375 -0.171875 C 2.566406 -0.00390625 2.25 0.078125 1.90625 0.078125 C 1.625 0.078125 1.367188 0.015625 1.140625 -0.109375 C 0.921875 -0.234375 0.753906 -0.410156 0.640625 -0.640625 C 0.535156 -0.867188 0.484375 -1.097656 0.484375 -1.328125 C 0.484375 -1.347656 0.484375 -1.382812 0.484375 -1.4375 Z M 0.484375 -1.4375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-0\" overflow=\"visible\">\n",
       "<path d=\"M 1.125 0 L 1.125 -5.625 L 5.625 -5.625 L 5.625 0 Z M 1.265625 -0.140625 L 5.484375 -0.140625 L 5.484375 -5.484375 L 1.265625 -5.484375 Z M 1.265625 -0.140625 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-1\" overflow=\"visible\">\n",
       "<path d=\"M 0.84375 0 L 0.84375 -6.4375 L 1.6875 -6.4375 L 1.6875 0 Z M 0.84375 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-2\" overflow=\"visible\">\n",
       "<path d=\"M 0.59375 0 L 0.59375 -4.671875 L 1.3125 -4.671875 L 1.3125 -4 C 1.644531 -4.507812 2.140625 -4.765625 2.796875 -4.765625 C 3.078125 -4.765625 3.332031 -4.710938 3.5625 -4.609375 C 3.800781 -4.515625 3.976562 -4.382812 4.09375 -4.21875 C 4.207031 -4.0625 4.289062 -3.867188 4.34375 -3.640625 C 4.375 -3.492188 4.390625 -3.238281 4.390625 -2.875 L 4.390625 0 L 3.59375 0 L 3.59375 -2.84375 C 3.59375 -3.164062 3.5625 -3.40625 3.5 -3.5625 C 3.4375 -3.71875 3.328125 -3.84375 3.171875 -3.9375 C 3.015625 -4.039062 2.832031 -4.09375 2.625 -4.09375 C 2.289062 -4.09375 2 -3.984375 1.75 -3.765625 C 1.507812 -3.554688 1.390625 -3.148438 1.390625 -2.546875 L 1.390625 0 Z M 0.59375 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-3\" overflow=\"visible\">\n",
       "<path d=\"M 0.59375 1.78125 L 0.59375 -4.671875 L 1.3125 -4.671875 L 1.3125 -4.0625 C 1.476562 -4.300781 1.664062 -4.476562 1.875 -4.59375 C 2.09375 -4.707031 2.359375 -4.765625 2.671875 -4.765625 C 3.066406 -4.765625 3.414062 -4.660156 3.71875 -4.453125 C 4.019531 -4.253906 4.25 -3.96875 4.40625 -3.59375 C 4.5625 -3.21875 4.640625 -2.8125 4.640625 -2.375 C 4.640625 -1.894531 4.550781 -1.460938 4.375 -1.078125 C 4.207031 -0.691406 3.960938 -0.394531 3.640625 -0.1875 C 3.316406 0.0078125 2.972656 0.109375 2.609375 0.109375 C 2.347656 0.109375 2.113281 0.0507812 1.90625 -0.0625 C 1.695312 -0.175781 1.523438 -0.316406 1.390625 -0.484375 L 1.390625 1.78125 Z M 1.3125 -2.3125 C 1.3125 -1.707031 1.429688 -1.257812 1.671875 -0.96875 C 1.921875 -0.6875 2.21875 -0.546875 2.5625 -0.546875 C 2.90625 -0.546875 3.203125 -0.691406 3.453125 -0.984375 C 3.710938 -1.285156 3.84375 -1.75 3.84375 -2.375 C 3.84375 -2.96875 3.71875 -3.410156 3.46875 -3.703125 C 3.226562 -4.003906 2.9375 -4.15625 2.59375 -4.15625 C 2.257812 -4.15625 1.960938 -3.992188 1.703125 -3.671875 C 1.441406 -3.359375 1.3125 -2.90625 1.3125 -2.3125 Z M 1.3125 -2.3125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-4\" overflow=\"visible\">\n",
       "<path d=\"M 3.65625 0 L 3.65625 -0.6875 C 3.289062 -0.15625 2.796875 0.109375 2.171875 0.109375 C 1.898438 0.109375 1.644531 0.0546875 1.40625 -0.046875 C 1.164062 -0.160156 0.984375 -0.296875 0.859375 -0.453125 C 0.742188 -0.609375 0.664062 -0.800781 0.625 -1.03125 C 0.59375 -1.1875 0.578125 -1.4375 0.578125 -1.78125 L 0.578125 -4.671875 L 1.359375 -4.671875 L 1.359375 -2.078125 C 1.359375 -1.660156 1.378906 -1.382812 1.421875 -1.25 C 1.460938 -1.039062 1.5625 -0.875 1.71875 -0.75 C 1.882812 -0.632812 2.085938 -0.578125 2.328125 -0.578125 C 2.566406 -0.578125 2.789062 -0.632812 3 -0.75 C 3.207031 -0.875 3.351562 -1.039062 3.4375 -1.25 C 3.519531 -1.457031 3.5625 -1.765625 3.5625 -2.171875 L 3.5625 -4.671875 L 4.359375 -4.671875 L 4.359375 0 Z M 3.65625 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-5\" overflow=\"visible\">\n",
       "<path d=\"M 2.328125 -0.703125 L 2.4375 -0.015625 C 2.207031 0.0351562 2.007812 0.0625 1.84375 0.0625 C 1.550781 0.0625 1.328125 0.015625 1.171875 -0.078125 C 1.015625 -0.171875 0.898438 -0.289062 0.828125 -0.4375 C 0.765625 -0.582031 0.734375 -0.890625 0.734375 -1.359375 L 0.734375 -4.046875 L 0.15625 -4.046875 L 0.15625 -4.671875 L 0.734375 -4.671875 L 0.734375 -5.828125 L 1.53125 -6.296875 L 1.53125 -4.671875 L 2.328125 -4.671875 L 2.328125 -4.046875 L 1.53125 -4.046875 L 1.53125 -1.328125 C 1.53125 -1.097656 1.539062 -0.953125 1.5625 -0.890625 C 1.59375 -0.828125 1.640625 -0.773438 1.703125 -0.734375 C 1.765625 -0.691406 1.851562 -0.671875 1.96875 -0.671875 C 2.0625 -0.671875 2.179688 -0.679688 2.328125 -0.703125 Z M 2.328125 -0.703125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-6\" overflow=\"visible\">\n",
       "<path d=\"\" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-7\" overflow=\"visible\">\n",
       "<path d=\"M 0.578125 0 L 0.578125 -6.4375 L 1.359375 -6.4375 L 1.359375 0 Z M 0.578125 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-8\" overflow=\"visible\">\n",
       "<path d=\"M 3.640625 -0.578125 C 3.347656 -0.328125 3.066406 -0.148438 2.796875 -0.046875 C 2.523438 0.0546875 2.234375 0.109375 1.921875 0.109375 C 1.410156 0.109375 1.015625 -0.015625 0.734375 -0.265625 C 0.460938 -0.515625 0.328125 -0.835938 0.328125 -1.234375 C 0.328125 -1.460938 0.378906 -1.671875 0.484375 -1.859375 C 0.585938 -2.046875 0.722656 -2.195312 0.890625 -2.3125 C 1.054688 -2.425781 1.242188 -2.515625 1.453125 -2.578125 C 1.609375 -2.609375 1.84375 -2.644531 2.15625 -2.6875 C 2.800781 -2.757812 3.273438 -2.851562 3.578125 -2.96875 C 3.578125 -3.070312 3.578125 -3.140625 3.578125 -3.171875 C 3.578125 -3.492188 3.503906 -3.71875 3.359375 -3.84375 C 3.148438 -4.03125 2.847656 -4.125 2.453125 -4.125 C 2.078125 -4.125 1.800781 -4.054688 1.625 -3.921875 C 1.445312 -3.796875 1.316406 -3.566406 1.234375 -3.234375 L 0.46875 -3.328125 C 0.53125 -3.660156 0.640625 -3.925781 0.796875 -4.125 C 0.960938 -4.332031 1.195312 -4.488281 1.5 -4.59375 C 1.8125 -4.707031 2.164062 -4.765625 2.5625 -4.765625 C 2.96875 -4.765625 3.289062 -4.71875 3.53125 -4.625 C 3.78125 -4.53125 3.960938 -4.410156 4.078125 -4.265625 C 4.203125 -4.128906 4.285156 -3.953125 4.328125 -3.734375 C 4.359375 -3.597656 4.375 -3.359375 4.375 -3.015625 L 4.375 -1.953125 C 4.375 -1.222656 4.390625 -0.757812 4.421875 -0.5625 C 4.453125 -0.363281 4.519531 -0.175781 4.625 0 L 3.796875 0 C 3.710938 -0.164062 3.660156 -0.359375 3.640625 -0.578125 Z M 3.578125 -2.34375 C 3.285156 -2.226562 2.851562 -2.128906 2.28125 -2.046875 C 1.957031 -1.992188 1.726562 -1.9375 1.59375 -1.875 C 1.457031 -1.820312 1.351562 -1.738281 1.28125 -1.625 C 1.207031 -1.507812 1.171875 -1.382812 1.171875 -1.25 C 1.171875 -1.039062 1.25 -0.863281 1.40625 -0.71875 C 1.5625 -0.582031 1.796875 -0.515625 2.109375 -0.515625 C 2.410156 -0.515625 2.679688 -0.582031 2.921875 -0.71875 C 3.160156 -0.851562 3.335938 -1.035156 3.453125 -1.265625 C 3.535156 -1.441406 3.578125 -1.703125 3.578125 -2.046875 Z M 3.578125 -2.34375 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-9\" overflow=\"visible\">\n",
       "<path d=\"M 0.5625 1.796875 L 0.46875 1.0625 C 0.644531 1.101562 0.796875 1.125 0.921875 1.125 C 1.097656 1.125 1.238281 1.09375 1.34375 1.03125 C 1.445312 0.976562 1.535156 0.898438 1.609375 0.796875 C 1.648438 0.710938 1.726562 0.515625 1.84375 0.203125 C 1.863281 0.160156 1.890625 0.0976562 1.921875 0.015625 L 0.140625 -4.671875 L 1 -4.671875 L 1.96875 -1.96875 C 2.09375 -1.625 2.207031 -1.265625 2.3125 -0.890625 C 2.394531 -1.242188 2.5 -1.597656 2.625 -1.953125 L 3.625 -4.671875 L 4.421875 -4.671875 L 2.640625 0.078125 C 2.453125 0.585938 2.304688 0.941406 2.203125 1.140625 C 2.054688 1.398438 1.894531 1.585938 1.71875 1.703125 C 1.539062 1.828125 1.320312 1.890625 1.0625 1.890625 C 0.914062 1.890625 0.75 1.859375 0.5625 1.796875 Z M 0.5625 1.796875 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-10\" overflow=\"visible\">\n",
       "<path d=\"M 3.78125 -1.5 L 4.609375 -1.40625 C 4.472656 -0.925781 4.226562 -0.550781 3.875 -0.28125 C 3.53125 -0.0195312 3.085938 0.109375 2.546875 0.109375 C 1.867188 0.109375 1.328125 -0.0976562 0.921875 -0.515625 C 0.523438 -0.941406 0.328125 -1.535156 0.328125 -2.296875 C 0.328125 -3.078125 0.53125 -3.679688 0.9375 -4.109375 C 1.34375 -4.546875 1.867188 -4.765625 2.515625 -4.765625 C 3.140625 -4.765625 3.644531 -4.550781 4.03125 -4.125 C 4.425781 -3.707031 4.625 -3.113281 4.625 -2.34375 C 4.625 -2.289062 4.625 -2.21875 4.625 -2.125 L 1.140625 -2.125 C 1.171875 -1.613281 1.316406 -1.222656 1.578125 -0.953125 C 1.835938 -0.679688 2.164062 -0.546875 2.5625 -0.546875 C 2.851562 -0.546875 3.097656 -0.617188 3.296875 -0.765625 C 3.503906 -0.921875 3.664062 -1.164062 3.78125 -1.5 Z M 1.1875 -2.78125 L 3.796875 -2.78125 C 3.765625 -3.175781 3.664062 -3.472656 3.5 -3.671875 C 3.25 -3.972656 2.921875 -4.125 2.515625 -4.125 C 2.148438 -4.125 1.84375 -4 1.59375 -3.75 C 1.351562 -3.507812 1.21875 -3.1875 1.1875 -2.78125 Z M 1.1875 -2.78125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-11\" overflow=\"visible\">\n",
       "<path d=\"M 0.578125 0 L 0.578125 -4.671875 L 1.296875 -4.671875 L 1.296875 -3.953125 C 1.472656 -4.285156 1.640625 -4.503906 1.796875 -4.609375 C 1.953125 -4.710938 2.125 -4.765625 2.3125 -4.765625 C 2.570312 -4.765625 2.84375 -4.679688 3.125 -4.515625 L 2.84375 -3.78125 C 2.65625 -3.894531 2.460938 -3.953125 2.265625 -3.953125 C 2.097656 -3.953125 1.941406 -3.898438 1.796875 -3.796875 C 1.660156 -3.691406 1.5625 -3.546875 1.5 -3.359375 C 1.414062 -3.078125 1.375 -2.769531 1.375 -2.4375 L 1.375 0 Z M 0.578125 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-12\" overflow=\"visible\">\n",
       "<path d=\"M 0.71875 0 L 0.71875 -6.4375 L 1.578125 -6.4375 L 1.578125 -3.796875 L 4.921875 -3.796875 L 4.921875 -6.4375 L 5.78125 -6.4375 L 5.78125 0 L 4.921875 0 L 4.921875 -3.03125 L 1.578125 -3.03125 L 1.578125 0 Z M 0.71875 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-13\" overflow=\"visible\">\n",
       "<path d=\"M 0.59375 -5.53125 L 0.59375 -6.4375 L 1.390625 -6.4375 L 1.390625 -5.53125 Z M 0.59375 0 L 0.59375 -4.671875 L 1.390625 -4.671875 L 1.390625 0 Z M 0.59375 0 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-14\" overflow=\"visible\">\n",
       "<path d=\"M 3.625 0 L 3.625 -0.59375 C 3.320312 -0.125 2.882812 0.109375 2.3125 0.109375 C 1.945312 0.109375 1.609375 0.00390625 1.296875 -0.203125 C 0.984375 -0.410156 0.738281 -0.695312 0.5625 -1.0625 C 0.394531 -1.425781 0.3125 -1.847656 0.3125 -2.328125 C 0.3125 -2.796875 0.390625 -3.21875 0.546875 -3.59375 C 0.703125 -3.976562 0.929688 -4.269531 1.234375 -4.46875 C 1.546875 -4.664062 1.894531 -4.765625 2.28125 -4.765625 C 2.5625 -4.765625 2.8125 -4.707031 3.03125 -4.59375 C 3.25 -4.476562 3.425781 -4.320312 3.5625 -4.125 L 3.5625 -6.4375 L 4.359375 -6.4375 L 4.359375 0 Z M 1.125 -2.328125 C 1.125 -1.734375 1.25 -1.285156 1.5 -0.984375 C 1.75 -0.691406 2.046875 -0.546875 2.390625 -0.546875 C 2.734375 -0.546875 3.023438 -0.6875 3.265625 -0.96875 C 3.515625 -1.25 3.640625 -1.679688 3.640625 -2.265625 C 3.640625 -2.898438 3.515625 -3.367188 3.265625 -3.671875 C 3.015625 -3.972656 2.710938 -4.125 2.359375 -4.125 C 2.003906 -4.125 1.707031 -3.976562 1.46875 -3.6875 C 1.238281 -3.394531 1.125 -2.941406 1.125 -2.328125 Z M 1.125 -2.328125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "<symbol id=\"glyph2-15\" overflow=\"visible\">\n",
       "<path d=\"M 0.4375 -3.140625 C 0.4375 -4.203125 0.722656 -5.035156 1.296875 -5.640625 C 1.867188 -6.253906 2.609375 -6.5625 3.515625 -6.5625 C 4.109375 -6.5625 4.644531 -6.414062 5.125 -6.125 C 5.601562 -5.84375 5.96875 -5.445312 6.21875 -4.9375 C 6.46875 -4.425781 6.59375 -3.851562 6.59375 -3.21875 C 6.59375 -2.5625 6.460938 -1.972656 6.203125 -1.453125 C 5.941406 -0.941406 5.566406 -0.550781 5.078125 -0.28125 C 4.597656 -0.0195312 4.078125 0.109375 3.515625 0.109375 C 2.910156 0.109375 2.367188 -0.0351562 1.890625 -0.328125 C 1.410156 -0.617188 1.046875 -1.019531 0.796875 -1.53125 C 0.554688 -2.039062 0.4375 -2.578125 0.4375 -3.140625 Z M 1.3125 -3.125 C 1.3125 -2.34375 1.519531 -1.726562 1.9375 -1.28125 C 2.351562 -0.84375 2.878906 -0.625 3.515625 -0.625 C 4.148438 -0.625 4.675781 -0.847656 5.09375 -1.296875 C 5.507812 -1.742188 5.71875 -2.382812 5.71875 -3.21875 C 5.71875 -3.738281 5.628906 -4.191406 5.453125 -4.578125 C 5.273438 -4.972656 5.015625 -5.28125 4.671875 -5.5 C 4.328125 -5.71875 3.945312 -5.828125 3.53125 -5.828125 C 2.925781 -5.828125 2.40625 -5.617188 1.96875 -5.203125 C 1.53125 -4.785156 1.3125 -4.09375 1.3125 -3.125 Z M 1.3125 -3.125 \" style=\"stroke:none;\"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface1\">\n",
       "<path d=\"M 124.015625 139.234375 C 128.996094 144.214844 128.996094 152.285156 124.015625 157.265625 C 119.035156 162.246094 110.964844 162.246094 105.984375 157.265625 C 101.003906 152.285156 101.003906 144.214844 105.984375 139.234375 C 110.964844 134.253906 119.035156 134.253906 124.015625 139.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.802856%,85.096741%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"87.803467\" xlink:href=\"#glyph0-1\" y=\"138.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"92.303467\" xlink:href=\"#glyph1-1\" y=\"140.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 176.890625 139.234375 C 181.871094 144.214844 181.871094 152.285156 176.890625 157.265625 C 171.910156 162.246094 163.839844 162.246094 158.859375 157.265625 C 153.878906 152.285156 153.878906 144.214844 158.859375 139.234375 C 163.839844 134.253906 171.910156 134.253906 176.890625 139.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.802856%,85.096741%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"140.678467\" xlink:href=\"#glyph0-1\" y=\"138.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"145.178467\" xlink:href=\"#glyph1-2\" y=\"140.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 157.015625 78.234375 C 161.996094 83.214844 161.996094 91.285156 157.015625 96.265625 C 152.035156 101.246094 143.964844 101.246094 138.984375 96.265625 C 134.003906 91.285156 134.003906 83.214844 138.984375 78.234375 C 143.964844 73.253906 152.035156 73.253906 157.015625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.900818%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"120.550781\" xlink:href=\"#glyph0-2\" y=\"77.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"125.556152\" xlink:href=\"#glyph1-2\" y=\"79.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"9.98755\" xlink:href=\"#glyph2-1\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"12.48775\" xlink:href=\"#glyph2-2\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"17.49355\" xlink:href=\"#glyph2-3\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"22.49935\" xlink:href=\"#glyph2-4\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"27.50515\" xlink:href=\"#glyph2-5\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"30.00535\" xlink:href=\"#glyph2-6\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"32.50555\" xlink:href=\"#glyph2-7\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"34.50535\" xlink:href=\"#glyph2-8\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"39.51115\" xlink:href=\"#glyph2-9\" y=\"138.352783\"/>\n",
       "  <use x=\"44.01115\" xlink:href=\"#glyph2-10\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"49.01695\" xlink:href=\"#glyph2-11\" y=\"138.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"5.73584\" xlink:href=\"#glyph2-12\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"12.23564\" xlink:href=\"#glyph2-13\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"14.23544\" xlink:href=\"#glyph2-14\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"19.24124\" xlink:href=\"#glyph2-14\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"24.24704\" xlink:href=\"#glyph2-10\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"29.25284\" xlink:href=\"#glyph2-2\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"34.25864\" xlink:href=\"#glyph2-6\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"36.75884\" xlink:href=\"#glyph2-7\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"38.75864\" xlink:href=\"#glyph2-8\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"43.76444\" xlink:href=\"#glyph2-9\" y=\"78.102783\"/>\n",
       "  <use x=\"48.26444\" xlink:href=\"#glyph2-10\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"53.27024\" xlink:href=\"#glyph2-11\" y=\"78.102783\"/>\n",
       "</g>\n",
       "<path d=\"M 229.765625 139.234375 C 234.746094 144.214844 234.746094 152.285156 229.765625 157.265625 C 224.785156 162.246094 216.714844 162.246094 211.734375 157.265625 C 206.753906 152.285156 206.753906 144.214844 211.734375 139.234375 C 216.714844 134.253906 224.785156 134.253906 229.765625 139.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.802856%,85.096741%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"193.553467\" xlink:href=\"#glyph0-1\" y=\"138.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"198.053467\" xlink:href=\"#glyph1-3\" y=\"140.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 282.640625 138.484375 C 287.621094 143.464844 287.621094 151.535156 282.640625 156.515625 C 277.660156 161.496094 269.589844 161.496094 264.609375 156.515625 C 259.628906 151.535156 259.628906 143.464844 264.609375 138.484375 C 269.589844 133.503906 277.660156 133.503906 282.640625 138.484375 \" style=\"fill-rule:nonzero;fill:rgb(69.802856%,85.096741%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"246.428467\" xlink:href=\"#glyph0-1\" y=\"137.885498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"250.928467\" xlink:href=\"#glyph1-4\" y=\"139.885498\"/>\n",
       "</g>\n",
       "<path d=\"M 248.265625 78.234375 C 253.246094 83.214844 253.246094 91.285156 248.265625 96.265625 C 243.285156 101.246094 235.214844 101.246094 230.234375 96.265625 C 225.253906 91.285156 225.253906 83.214844 230.234375 78.234375 C 235.214844 73.253906 243.285156 73.253906 248.265625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.900818%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"211.800781\" xlink:href=\"#glyph0-2\" y=\"77.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"216.806152\" xlink:href=\"#glyph1-4\" y=\"79.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 202.640625 78.234375 C 207.621094 83.214844 207.621094 91.285156 202.640625 96.265625 C 197.660156 101.246094 189.589844 101.246094 184.609375 96.265625 C 179.628906 91.285156 179.628906 83.214844 184.609375 78.234375 C 189.589844 73.253906 197.660156 73.253906 202.640625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.900818%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"166.175781\" xlink:href=\"#glyph0-2\" y=\"77.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"171.181152\" xlink:href=\"#glyph1-3\" y=\"79.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 149.765625 17.234375 C 154.746094 22.214844 154.746094 30.285156 149.765625 35.265625 C 144.785156 40.246094 136.714844 40.246094 131.734375 35.265625 C 126.753906 30.285156 126.753906 22.214844 131.734375 17.234375 C 136.714844 12.253906 144.785156 12.253906 149.765625 17.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.802856%,85.096741%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"113.300781\" xlink:href=\"#glyph0-3\" y=\"16.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"118.306152\" xlink:href=\"#glyph1-1\" y=\"18.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 202.640625 17.234375 C 207.621094 22.214844 207.621094 30.285156 202.640625 35.265625 C 197.660156 40.246094 189.589844 40.246094 184.609375 35.265625 C 179.628906 30.285156 179.628906 22.214844 184.609375 17.234375 C 189.589844 12.253906 197.660156 12.253906 202.640625 17.234375 \" style=\"fill-rule:nonzero;fill:rgb(69.802856%,85.096741%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"166.175781\" xlink:href=\"#glyph0-3\" y=\"16.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"171.181152\" xlink:href=\"#glyph1-2\" y=\"18.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 255.515625 16.484375 C 260.496094 21.464844 260.496094 29.535156 255.515625 34.515625 C 250.535156 39.496094 242.464844 39.496094 237.484375 34.515625 C 232.503906 29.535156 232.503906 21.464844 237.484375 16.484375 C 242.464844 11.503906 250.535156 11.503906 255.515625 16.484375 \" style=\"fill-rule:nonzero;fill:rgb(69.802856%,85.096741%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"219.050781\" xlink:href=\"#glyph0-3\" y=\"15.885498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"224.056152\" xlink:href=\"#glyph1-3\" y=\"17.885498\"/>\n",
       "</g>\n",
       "<path d=\"M 111.390625 78.234375 C 116.371094 83.214844 116.371094 91.285156 111.390625 96.265625 C 106.410156 101.246094 98.339844 101.246094 93.359375 96.265625 C 88.378906 91.285156 88.378906 83.214844 93.359375 78.234375 C 98.339844 73.253906 106.410156 73.253906 111.390625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.900818%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"74.925781\" xlink:href=\"#glyph0-2\" y=\"77.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"79.931152\" xlink:href=\"#glyph1-1\" y=\"79.635498\"/>\n",
       "</g>\n",
       "<path d=\"M 293.890625 78.234375 C 298.871094 83.214844 298.871094 91.285156 293.890625 96.265625 C 288.910156 101.246094 280.839844 101.246094 275.859375 96.265625 C 270.878906 91.285156 270.878906 83.214844 275.859375 78.234375 C 280.839844 73.253906 288.910156 73.253906 293.890625 78.234375 \" style=\"fill-rule:nonzero;fill:rgb(39.99939%,74.900818%,100%);fill-opacity:1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"257.425781\" xlink:href=\"#glyph0-2\" y=\"77.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"262.431152\" xlink:href=\"#glyph1-5\" y=\"79.635498\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"6.4873\" xlink:href=\"#glyph2-15\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"13.4875\" xlink:href=\"#glyph2-4\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"18.4933\" xlink:href=\"#glyph2-5\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"20.9935\" xlink:href=\"#glyph2-3\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"25.9993\" xlink:href=\"#glyph2-4\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"31.0051\" xlink:href=\"#glyph2-5\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"33.5053\" xlink:href=\"#glyph2-6\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"36.0055\" xlink:href=\"#glyph2-7\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"38.0053\" xlink:href=\"#glyph2-8\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"43.0111\" xlink:href=\"#glyph2-9\" y=\"16.352783\"/>\n",
       "  <use x=\"47.5111\" xlink:href=\"#glyph2-10\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use x=\"52.5169\" xlink:href=\"#glyph2-11\" y=\"16.352783\"/>\n",
       "</g>\n",
       "<path d=\"M 109.164062 76.457031 L 130.816406 42.039062 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 132.949219 38.652344 L 130.816406 42.039062 M 129.546875 41.238281 L 132.949219 38.652344 L 132.085938 42.835938 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 112.976562 80.164062 L 178.117188 36.617188 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 181.445312 34.394531 L 178.117188 36.617188 M 177.285156 35.367188 L 181.445312 34.394531 L 178.953125 37.863281 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 114.097656 82.226562 L 229.355469 32.847656 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 233.03125 31.269531 L 229.355469 32.847656 M 228.761719 31.46875 L 233.03125 31.269531 L 229.945312 34.226562 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 146.496094 74.589844 L 142.953125 44.769531 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 142.480469 40.796875 L 142.953125 44.769531 M 141.460938 44.945312 L 142.480469 40.796875 L 144.441406 44.59375 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 155.636719 77.039062 L 182.453125 41.1875 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 184.847656 37.984375 L 182.453125 41.1875 M 181.253906 40.289062 L 184.847656 37.984375 L 183.65625 42.085938 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 158.804688 80.476562 L 230.695312 35.40625 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 234.085938 33.28125 L 230.695312 35.40625 M 229.898438 34.136719 L 234.085938 33.28125 L 231.492188 36.679688 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 185.273438 77.613281 L 152.964844 40.34375 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 150.347656 37.320312 L 152.964844 40.34375 M 151.832031 41.324219 L 150.347656 37.320312 L 154.097656 39.359375 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 193.625 74.5 L 193.625 44.898438 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 193.625 40.898438 L 193.625 44.898438 M 192.125 44.898438 L 193.625 40.898438 L 195.125 44.898438 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 201.917969 77.566406 L 234.371094 39.667969 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 236.972656 36.628906 L 234.371094 39.667969 M 233.230469 38.691406 L 236.972656 36.628906 L 235.507812 40.640625 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 228.40625 80.535156 L 156.609375 36.070312 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 153.207031 33.964844 L 156.609375 36.070312 M 155.820312 37.347656 L 153.207031 33.964844 L 157.398438 34.796875 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 231.613281 77.039062 L 204.796875 41.1875 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 202.402344 37.984375 L 204.796875 41.1875 M 203.59375 42.085938 L 202.402344 37.984375 L 205.996094 40.289062 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 240.738281 74.585938 L 244.324219 44.023438 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 244.792969 40.050781 L 244.324219 44.023438 M 242.835938 43.847656 L 244.792969 40.050781 L 245.816406 44.199219 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 273.128906 82.277344 L 157.929688 33.519531 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 154.246094 31.960938 L 157.929688 33.519531 M 157.34375 34.902344 L 154.246094 31.960938 L 158.511719 32.140625 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 274.273438 80.164062 L 209.132812 36.617188 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 205.804688 34.394531 L 209.132812 36.617188 M 208.296875 37.863281 L 205.804688 34.394531 L 209.964844 35.367188 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 278.144531 76.417969 L 256.34375 41.34375 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 254.234375 37.945312 L 256.34375 41.34375 M 255.070312 42.132812 L 254.234375 37.945312 L 257.621094 40.550781 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 112.414062 135.761719 L 106.15625 105.515625 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 105.34375 101.597656 L 106.15625 105.515625 M 104.6875 105.820312 L 105.34375 101.597656 L 107.625 105.210938 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 121.066406 137.03125 L 139.125 103.65625 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 141.027344 100.136719 L 139.125 103.65625 M 137.804688 102.941406 L 141.027344 100.136719 L 140.445312 104.371094 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 125.074219 140.433594 L 178.890625 98.683594 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 182.050781 96.230469 L 178.890625 98.683594 M 177.96875 97.496094 L 182.050781 96.230469 L 179.808594 99.867188 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 126.449219 142.628906 L 222.503906 95.46875 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 226.097656 93.707031 L 222.503906 95.46875 M 221.84375 94.125 L 226.097656 93.707031 L 223.167969 96.816406 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 127.003906 143.941406 L 267.320312 93.554688 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 271.085938 92.203125 L 267.320312 93.554688 M 266.8125 92.140625 L 271.085938 92.203125 L 267.828125 94.964844 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 158.542969 139.558594 L 116.023438 99.960938 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 113.097656 97.234375 L 116.023438 99.960938 M 115 101.058594 L 113.097656 97.234375 L 117.046875 98.863281 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 163.925781 136.125 L 153.777344 104.984375 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 152.539062 101.183594 L 153.777344 104.984375 M 152.351562 105.449219 L 152.539062 101.183594 L 155.203125 104.519531 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 172.835938 136.5 L 186.371094 104.433594 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 187.925781 100.75 L 186.371094 104.433594 M 184.988281 103.851562 L 187.925781 100.75 L 187.753906 105.019531 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 177.566406 139.964844 L 225.070312 99.367188 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 228.113281 96.769531 L 225.070312 99.367188 M 224.097656 98.226562 L 228.113281 96.769531 L 226.046875 100.507812 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 179.183594 142.355469 L 268.335938 95.875 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 271.882812 94.023438 L 268.335938 95.875 M 267.640625 94.542969 L 271.882812 94.023438 L 269.027344 97.203125 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 209.414062 142.40625 L 118.957031 95.792969 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 115.402344 93.960938 L 118.957031 95.792969 M 118.269531 97.128906 L 115.402344 93.960938 L 119.644531 94.460938 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 210.980469 140.058594 L 162.292969 99.234375 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 159.226562 96.664062 L 162.292969 99.234375 M 161.328125 100.382812 L 159.226562 96.664062 L 163.253906 98.082031 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 215.566406 136.597656 L 201.203125 104.292969 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 199.578125 100.640625 L 201.203125 104.292969 M 199.832031 104.902344 L 199.578125 100.640625 L 202.574219 103.683594 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 224.449219 136.046875 L 233.835938 105.101562 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 234.996094 101.273438 L 233.835938 105.101562 M 232.402344 104.664062 L 234.996094 101.273438 L 235.273438 105.535156 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 229.988281 139.460938 L 271.363281 100.105469 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 274.261719 97.347656 L 271.363281 100.105469 M 270.328125 99.015625 L 274.261719 97.347656 L 272.394531 101.191406 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 261.59375 143.265625 L 119.96875 93.441406 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 116.199219 92.113281 L 119.96875 93.441406 M 119.472656 94.855469 L 116.199219 92.113281 L 120.46875 92.027344 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 262.125 141.984375 L 164.820312 95.316406 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 161.210938 93.585938 L 164.820312 95.316406 M 164.171875 96.667969 L 161.210938 93.585938 L 165.46875 93.964844 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 263.4375 139.828125 L 208.523438 98.472656 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 205.328125 96.0625 L 208.523438 98.472656 M 207.621094 99.667969 L 205.328125 96.0625 L 209.425781 97.273438 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 267.304688 136.421875 L 248.492188 103.453125 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 246.511719 99.976562 L 248.492188 103.453125 M 247.191406 104.195312 L 246.511719 99.976562 L 249.796875 102.707031 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 275.964844 134.964844 L 281.453125 105.585938 \" style=\"fill:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "<path d=\"M 282.1875 101.652344 L 281.453125 105.585938 M 279.976562 105.308594 L 282.1875 101.652344 L 282.925781 105.859375 \" style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0,0,1,-23,-12)\"/>\n",
       "</g>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "SVG(filename='../img/mlp.svg')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The multilayer perceptron above has 4 inputs and 3 outputs,\n",
    "and the hidden layer in the middle contains 5 hidden units.\n",
    "Since the input layer does not involve any calculations,\n",
    "building this network would consist of\n",
    "implementing 2 layers of computation.\n",
    "The neurons in the input layer are fully connected\n",
    "to the inputs in the hidden layer.\n",
    "Likewise, the neurons in the hidden layer\n",
    "are fully connected to the neurons in the output layer.\n",
    "\n",
    "\n",
    "### From linear to nonlinear\n",
    "\n",
    "We can write out the calculations that define this one-hidden-layer MLP in mathematical notation as follows:\n",
    "$$\n",
    "\\begin{aligned}\n",
    "    \\mathbf{h} & = \\mathbf{W}_1 \\mathbf{x} + \\mathbf{b}_1 \\\\\n",
    "    \\mathbf{o} & = \\mathbf{W}_2 \\mathbf{h} + \\mathbf{b}_2 \\\\\n",
    "    \\hat{\\mathbf{y}} & = \\mathrm{softmax}(\\mathbf{o})\n",
    "\\end{aligned}\n",
    "$$\n",
    "\n",
    "By adding another layer, we have added two new sets of parameters,\n",
    "but what have we gained in exchange?\n",
    "In the model defined above, we do not achieve anything for our troubles!\n",
    "\n",
    "That's because our hidden units are just a linear function of the inputs\n",
    "and the outputs (pre-softmax) are just a linear function of the hidden units.\n",
    "A linear function of a linear function is itself a linear function.\n",
    "That means that for any values of the weights,\n",
    "we could just collapse out the hidden layer\n",
    "yielding an equivalent single-layer model using\n",
    "$\\mathbf{W} = \\mathbf{W}_2 \\mathbf{W}_1$ and $\\mathbf{b} = \\mathbf{W}_2 \\mathbf{b}_1 + \\mathbf{b}_2$.\n",
    "\n",
    "$$\\mathbf{o} = \\mathbf{W}_2 \\mathbf{h} + \\mathbf{b}_2 = \\mathbf{W}_2 (\\mathbf{W}_1 \\mathbf{x} + \\mathbf{b}_1) + \\mathbf{b}_2 = (\\mathbf{W}_2 \\mathbf{W}_1) \\mathbf{x} + (\\mathbf{W}_2 \\mathbf{b}_1 + \\mathbf{b}_2) = \\mathbf{W} \\mathbf{x} + \\mathbf{b}$$\n",
    "\n",
    "In order to get a benefit from multilayer architectures,\n",
    "we need another key ingredient—a nonlinearity $\\sigma$ to be applied to each of the hidden units after each layer's linear transformation.\n",
    "The most popular choice for the nonlinearity these days is the rectified linear unit (ReLU) $\\mathrm{max}(x,0)$.\n",
    "After incorporating these non-linearities\n",
    "it becomes impossible to merge layers.\n",
    "\n",
    "$$\n",
    "\\begin{aligned}\n",
    "    \\mathbf{h} & = \\sigma(\\mathbf{W}_1 \\mathbf{x} + \\mathbf{b}_1) \\\\\n",
    "    \\mathbf{o} & = \\mathbf{W}_2 \\mathbf{h} + \\mathbf{b}_2 \\\\\n",
    "    \\hat{\\mathbf{y}} & = \\mathrm{softmax}(\\mathbf{o})\n",
    "\\end{aligned}\n",
    "$$\n",
    "\n",
    "Clearly, we could continue stacking such hidden layers,\n",
    "e.g. $\\mathbf{h}_1 = \\sigma(\\mathbf{W}_1 \\mathbf{x} + \\mathbf{b}_1)$\n",
    "and $\\mathbf{h}_2 = \\sigma(\\mathbf{W}_2 \\mathbf{h}_1 + \\mathbf{b}_2)$\n",
    "on top of each other to obtain a true multilayer perceptron.\n",
    "\n",
    "Multilayer perceptrons can account for complex interactions in the inputs\n",
    "because the hidden neurons depend on the values of each of the inputs.\n",
    "It’s easy to design a hidden node that does arbitrary computation,\n",
    "such as, for instance, logical operations on its inputs.\n",
    "Moreover, for certain choices of the activation function\n",
    "it’s widely known that multilayer perceptrons are universal approximators.\n",
    "That means that even for a single-hidden-layer neural network,\n",
    "with enough nodes, and the right set of weights,\n",
    "we can model any function at all!\n",
    "*Actually learning that function is the hard part.*\n",
    "\n",
    "Moreover, just because a single-layer network *can* learn any function\n",
    "doesn't mean that you should try to solve all of your problems with single-layer networks.\n",
    "It turns out that we can approximate many functions\n",
    "much more compactly if we use deeper (vs wider) neural networks.\n",
    "We’ll get more into the math in a subsequent chapter,\n",
    "but for now let’s actually build an MLP.\n",
    "In this example, we’ll implement a multilayer perceptron\n",
    "with two hidden layers and one output layer.\n",
    "\n",
    "### Vectorization and mini-batch\n",
    "\n",
    "As before, by the matrix $\\mathbf{X}$, we denote a mini-batch of inputs.\n",
    "The calculations to produce outputs from an MLP with two hidden layers\n",
    "can thus be expressed:\n",
    "\n",
    "$$\n",
    "\\begin{aligned}\n",
    "    \\mathbf{H}_1 & = \\sigma(\\mathbf{W}_1 \\mathbf{X} + \\mathbf{b}_1) \\\\\n",
    "    \\mathbf{H}_2 & = \\sigma(\\mathbf{W}_2 \\mathbf{H}_1 + \\mathbf{b}_2) \\\\\n",
    "    \\mathbf{O} & = \\mathrm{softmax}(\\mathbf{W}_3 \\mathbf{H}_2 + \\mathbf{b}_3)\n",
    "\\end{aligned}\n",
    "$$\n",
    "\n",
    "With some abuse of notation, we define the nonlinearity $\\sigma$\n",
    "to apply to its inputs on a row-wise fashion, i.e. one observation at a time.\n",
    "Note that we are also using the notation for *softmax* in the same way to denote a row-wise operation.\n",
    "Often, as in this chapter, the activation functions that we apply to hidden layers are not merely row-wise, but component wise.\n",
    "That means that after computing the linear portion of the layer,\n",
    "we can calculate each nodes activation without looking at the values taken by the other hidden units.\n",
    "This is true for most activation functions\n",
    "(the batch normalization operation will be introduced in :numref:`chapter_batch_norm` is a notable exception to that rule).\n",
    "\n",
    "## Activation Functions\n",
    "\n",
    "Because they are so fundamental to deep learning, before going further,\n",
    "let's take a brief look at some common activation functions.\n",
    "\n",
    "### ReLU Function\n",
    "\n",
    "As stated above, the most popular choice,\n",
    "due to its simplicity of implementation\n",
    "and its efficacy in training is the rectified linear unit (ReLU).\n",
    "ReLUs provide a very simple nonlinear transformation.\n",
    "Given the element $z$, the function is defined\n",
    "as the maximum of that element and 0.\n",
    "\n",
    "$$\\mathrm{ReLU}(z) = \\max(z, 0).$$\n",
    "\n",
    "It can be understood that the ReLU function retains only positive elements and discards negative elements (setting those nodes to 0).\n",
    "To get a better idea of what it looks like, we can plot it.\n",
    "For convenience, we define a plotting function `xyplot`\n",
    "to take care of the groundwork."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.insert(0, '..')\n",
    "\n",
    "import numpy\n",
    "import matplotlib.pyplot as plt\n",
    "import torch\n",
    "import torch.nn as nn\n",
    "from torch.autograd import Variable\n",
    "def xyplot(x_vals,y_vals,name):\n",
    "    x_vals=x_vals.detach().numpy() # we can't directly use var.numpy() because varibles might \n",
    "    y_vals=y_vals.detach().numpy() # already required grad.,thus using var.detach().numpy() \n",
    "    plt.plot(x_vals,y_vals) \n",
    "    plt.xlabel('x')\n",
    "    plt.ylabel(name+'(x)')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Since relu is commomly used as activation function, PyTorch supports\n",
    "the `relu` function as a basic native operator.\n",
    "As you can see, the activation function is piece-wise linear.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEKCAYAAAARnO4WAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAHk1JREFUeJzt3Xl8VPXZ/vHPLYvIJihRlEUWEURkiRHBrRXRulW7qSDYWvuIBVGkVkWr7U9rWx+1KhW1D63aVgKoiEvdcV+qaBb2fSeAEPYlhGz374+ZtClCSIacObNc79eLlxkyyfcSwp2T75xzLnN3REQk9R0SdgAREYkPDXwRkTShgS8ikiY08EVE0oQGvohImtDAFxFJExr4IiJpQgNfRCRNaOCLiKSJ+mEHqKpVq1beoUOHsGOIiCSN3Nzcje6eUZPnJtTA79ChAzk5OWHHEBFJGma2sqbP1ZaOiEia0MAXEUkTgQ58MxttZnPNbI6ZTTKzRkGuJyIi+xfYwDezNsBNQJa79wDqAYOCWk9ERKoX9JZOfeAwM6sPNAbWBryeiIjsR2AD393XAA8Bq4B1wDZ3fyeo9UREpHpBbum0BC4DOgLHAk3MbOg+njfMzHLMLKewsDCoOCIiaS/ILZ2BwHJ3L3T3UmAqcPreT3L38e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8iQI4nELNXulilSZ8zsx0CZu0+Mdtv+y8wGuPv7YWcTiYWO8EVE0oT28EVE0oQGvohImtDAFxFJExr4IiJpQgNfRCRNaOCLiKQJDXwRkTShgS8ikib+PwhBcL9u5F9hAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=Variable(torch.arange(-8.0,8.0,0.1,dtype=torch.float32).reshape(int(16/0.1),1),requires_grad=True)\n",
    "y=torch.nn.functional.relu(x)\n",
    "xyplot(x,y,'relu')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "When the input is negative, the derivative of ReLU function is 0\n",
    "and when the input is positive, the derivative of ReLU function is 1.\n",
    "Note that the ReLU function is not differentiable\n",
    "when the input takes value precisely equal to  0.\n",
    "In these cases, we go with the left-hand-side (LHS) derivative\n",
    "and say that the derivative is 0 when the input is 0.\n",
    "We can get away with this because the input may never actually be zero.\n",
    "There's an old adage that if subtle boundary conditions matter,\n",
    "we are probably doing (*real*) mathematics, not engineering.\n",
    "That conventional wisdom may apply here.\n",
    "See the derivative of the ReLU function plotted below.\n",
    "\n",
    "When we use .backward(), by default it is .backward(torch.Tensor([1])).This is useful when we are dealing with single scalar input.But here we are dealing with a vector input so we have to use this snippet."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAGUpJREFUeJzt3XuQpXV95/H3ZwYQRRCFQdm5MGMcd0VXhWqQ9QqCFihCasu4sLJRtJwyFZCouwai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/T6SE7fZH0P4DpDmR+L3Ai8E7bn5P0BqrfBk5aAHXtAzyVqol/DHCtpGfO1/Gks9T2G8Cr56OOcTPVZfuL9T3vpeomuXI+axujaR5bMK0qSU8GPgf8mu1/WgD1nAo8aHurpOP7rmfMPsDRwLm2b5J0GXA+8Jt9FiXpqVStzzXAPwKflXSW7c+0+X0WZSjY3u1/8pI+RdWPCfBZ5rHpOktdvwJcX4fA/5I0oNrfZEeftUn6l1Rvwm9KgqqL5mZJx9r+Xl91jdT3JuBU4MSez/feDqwcuV7BAumalLQvVSBcafv6vuupvQQ4TdJrgP2BgyR9xvZZPdcF1b/ldttTLarrqEKhbycB37G9A0DS9cCLgVZDYW/sProfeEX9+SuB/91jLaO+QFUPkp4N7McC2IzL9rdsH2Z7te3VVD8wR89HIMxG0snArwOn2f5Jz+VsBtZKWiNpP6oBwA0914SqJP84cJftD/VdzxTbF9heUb+nzgC+tkACgfq9fZ+kf14/dCJwZ48lTbkXOE7Sk+p/1xPpYAB8UbYUZvE24LJ6oOZnwLqe65lyBXCFpNuBR4E39fybbwn+EHgC8NW6FbPJ9tv7KMT2TknnADdQzQq5wvYdfdQy5iXAvwO+JenW+rHfqM9Pj907F7iyDvh7gLN7roe6K+s64Gaq7tJb6GBlc1Y0R0TE0N7YfRQREbuRUIiIiKGEQkREDCUUIiJiKKEQERFDCYWIiBhKKERExFBCIeLnJOmY+kyH/SUdUO93/7y+64qYiyxei2iBpN+h2sPniVT75lzcc0kRc5JQiGhBvR3CZqqtU15se7LnkiLmJN1HEe14GvBk4ECqFkNEkdJSiGiBpA1Up62tAQ63fU7PJUXMyd64S2pEqyT9MrDT9lX1Wc1/LemVtr/Wd20ReyothYiIGMqYQkREDCUUIiJiKKEQERFDCYWIiBhKKERExFBCISIihhIKERExlFCIiIih/wcUcQGCewB+HgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "y.backward(torch.ones_like(x),retain_graph=True)\n",
    "xyplot(x,x.grad,\"grad of sigmoid\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that there are many variants to the ReLU function, such as the parameterized ReLU (pReLU) of [He et al., 2015](https://arxiv.org/abs/1502.01852). This variation adds a linear term to the ReLU, so some information still gets through, even when the argument is negative.\n",
    "\n",
    "$$\\mathrm{pReLU}(x) = \\max(0, x) + \\alpha \\min(0, x)$$\n",
    "\n",
    "The reason for using the ReLU is that its derivatives are particularly well behaved - either they vanish or they just let the argument through. This makes optimization better behaved and it reduces the issue of the vanishing gradient problem (more on this later).\n",
    "\n",
    "### Sigmoid Function\n",
    "\n",
    "The sigmoid function transforms its inputs which take values in $\\mathbb{R}$ to the interval $(0,1)$.\n",
    "For that reason, the sigmoid is often called a *squashing* function:\n",
    "it squashes any input in the range (-inf, inf)\n",
    "to some value in the range (0,1).\n",
    "\n",
    "$$\\mathrm{sigmoid}(x) = \\frac{1}{1 + \\exp(-x)}.$$\n",
    "\n",
    "In the earliest neural networks, scientists\n",
    "were interested in modeling biological neurons\n",
    "which either *fire* or *don't fire*.\n",
    "Thus the pioneers of this field, going all the way back to McCulloch and Pitts in the 1940s, were focused on thresholding units.\n",
    "A thresholding function takes either value $0$\n",
    "(if the input is below the threshold)\n",
    "or value $1$ (if the input exceeds the threshold)\n",
    "\n",
    "\n",
    "When attention shifted to gradient based learning,\n",
    "the sigmoid function was a natural choice\n",
    "because it is a smooth, differentiable approximation to a thresholding unit.\n",
    "Sigmoids are still common as activation functions on the output units,\n",
    "when we want to interpret the outputs as probabilities\n",
    "for binary classification problems\n",
    "(you can think of the sigmoid as a special case of the softmax)\n",
    "but the sigmoid has mostly been replaced by the simpler and easier to train ReLU for most use in hidden layers.\n",
    "In the \"Recurrent Neural Network\" chapter, we will describe\n",
    "how sigmoid units can be used to control\n",
    "the flow of information in a neural network\n",
    "thanks to its capacity to transform the value range between 0 and 1.\n",
    "\n",
    "See the sigmoid function plotted below.\n",
    "When the input is close to 0, the sigmoid function\n",
    "approaches a linear transformation.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xl8VPW9//HXZ7ITEhDCTiCgLAKK2rC4VsV97XJV3Op2pb23WrW9vbXtrW29v/7aa2u3W7t4lWrdAJda2ouKVm3dgIDgwiaRLWGHAAGyZz73jxnSGAMZMJMzy/v5eOQxc86cSd6Qybzne1Zzd0RERABCQQcQEZHEoVIQEZEWKgUREWmhUhARkRYqBRERaaFSEBGRFioFERFpoVIQEZEWKgUREWmRGXSAQ1VUVOQlJSVBxxARSSqLFi3a7u59Olou6UqhpKSEhQsXBh1DRCSpmNm6WJbT6iMREWmhUhARkRYqBRERaaFSEBGRFioFERFpEbdSMLPpZrbVzN4/wONmZr80s3Ize9fMTohXFhERiU08RwoPAecd5PHzgRHRr2nAb+KYRUREYhC34xTc/e9mVnKQRS4F/uCR64HOM7OeZjbA3TfFK5OIyMG4O43NTkNzmPrGZhqawzQ0Rb+awzSH/eNf7jSFnXA4ctvRMu5O2MGjP88dwu440VtvPR+cyPK4M+Xofowv7hnX/4MgD14bBFS0mq6MzvtYKZjZNCKjCYYMGdIl4UQkOdQ2NLOzpoGqfQ3sqmmkqqaB6tpG9tU3sa+hmX31TdQ0NLG3PnI/Mr+Jmvpm6pvC1DdFbve/8SfqZevNoF+P3JQuBWtnXru/Dne/H7gfoLS0NEF/ZSLSmeoam6moqmHj7jo2765l8+56NlfXsnl3HVuq69lZ08DOmgbqGsMH/T752Rl0y8m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0FrHH3bQBm9gxwEtCppZCOq482Ap+O3j8TWBVgltaeJZIHMxsJZJMAJ+Ny9/fcva+7l7h7CZE/mBO6ohA6YmbnAd8ALnH3moDjlAEjzGyYmWUT2QA4O+BMWKTJHwSWu/tPg86zn7t/090HR19TU4GXE6QQiL62K8xsVHTWFGBZgJH2Ww9MNrNu0d/rFOKwATwlRwoduBn4RXRDTR0wLeA8+00HppvZ+0ADcF3An3yTwa+AHODF6Chmnrt/KYgg7t5kZrcALxDZK2S6uy8NIksbJwPXAu+Z2ZLovG9Fr58uB3Yr8Fi04FcDNwSch+iqrKeAt4msLl1MHI5s1hHNIiLSIh1XH4mIyAGoFEREpIVKQUREWqgURESkhUpBRERaqBRERKSFSkFERFqoFEQ+ITObEL2mQ66Z5UfPdz8u6Fwih0MHr4l0AjP7f0TO4ZNH5Lw5Pww4kshhUSmIdILo6RDKiJw65SR3bw44kshh0eojkc7RC+gOFBAZMYgkJY0URDqBmc0mcrW1YcAAd78l4EgihyUdz5Iq0qnM7AtAk7s/Hr1W85tmdqa7vxx0NpFDpZGCiIi00DYFERFpoVIQEZEWKgUREWmhUhARkRYqBRERaaFSEBGRFioFERFpoVIQEZEW/wfvtLs9oLV34QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=Variable(torch.arange(-8.0,8.0,0.1,dtype=torch.float32).reshape(int(16/0.1),1),requires_grad=True)\n",
    "y=torch.sigmoid(x)\n",
    "xyplot(x,y,'sigmoid')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The derivative of sigmoid function is given by the following equation:\n",
    "\n",
    "$$\\frac{d}{dx} \\mathrm{sigmoid}(x) = \\frac{\\exp(-x)}{(1 + \\exp(-x))^2} = \\mathrm{sigmoid}(x)\\left(1-\\mathrm{sigmoid}(x)\\right).$$\n",
    "\n",
    "\n",
    "The derivative of sigmoid function is plotted below.\n",
    "Note that when the input is 0, the derivative of the sigmoid function\n",
    "reaches a maximum of 0.25. As the input diverges from 0 in either direction, the derivative approaches 0.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xd8XNWZ//HPI416sVVdZMmWLBsXim3kCrYx1TSTsCGUkEBCYMmGJJtkNz+ySWBD9heSsMsmu2E3IYHfhoQayIIJJGDAYBsXLOOCuyW5y5ZVrGKrzzy/P2ZkBlnSjKQZ3ZH0vF+veWnmzr0zX14Weu49555zRFUxxhhjehLldABjjDGRz4qFMcaYgKxYGGOMCciKhTHGmICsWBhjjAnIioUxxpiArFgYY4wJyIqFMcaYgKxYGGOMCcjldIBQyczM1AkTJjgdwxhjBpVNmzZVqWpWoP2GTLGYMGECxcXFTscwxphBRUQOBrOfNUMZY4wJyIqFMcaYgKxYGGOMCciKhTHGmICsWBhjjAkorMVCRJaKyB4RKRGR+7t4/1sislNEtonI2yIy3u89t4hs8T2WhzOnMcaYnoXt1lkRiQYeA64AjgAbRWS5qu70220zUKSqjSLyFeBnwM2+95pUdUa48hljjAleOMdZzAFKVLUMQESeA24AzhQLVV3pt/964PYw5jFmwLk9yq5j9WzYX0NGUizzJ2YwKjXe6VjG9Fo4i0UOcNjv9RFgbg/73wX8xe91vIgUA+3AT1T15c4HiMg9wD0AeXl5/Q5sTCjtOlbPV5/5kLLK05/YfnNRLj+8YTrxMdEOJTOm98JZLKSLbdrljiK3A0XAYr/NeapaLiIFwDsi8pGqln7iw1QfBx4HKCoq6vKzjXHC8q3lfOfFra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GIePDOAVPpVC4ROQ/vL+dWEQFvU8+HIjJHVY87lcsv3x3AdcBlA1FUexDR68mLSAzeQvG0qv7J6Tw+FwHLROQaIB5IFZE/qOrtDuc6AhxR1Y6rrxfxFgunXQ7sV9VKABH5E7AACGmxsGaoj5UDi33PLwX2OZils5fxZkJEJgOxODyJmap+pKrZqjpBVSfg/R9p1kAUikBEZCnwf4BlqtrocJxg1qJ3hHir/BPALlV91Ok8HVT1u6o6zvd7dQvwTgQUCny/24dF5BzfpsvwLv3stEPAPBFJ9P2bXkYYOt6H1ZVFAHcDv/B1EDUD9zicx9+TwJMish1oBe5w+Gw50v0SiANW+K561qvqvU4E6W4teieydOEi4PPARyKyxbftn1T1dQczRbqvAU/7Cn8Z8EWH8+BrEnsR+BBvs+tmwjCS20ZwG2OMCciaoYwxxgRkxcIYY0xAViyMMcYEZMXCGGNMQFYsjDHGBGTFwhhjTEBWLIwxxgRkxcKYMBGR2b41NeJFJMm33sC5Tucypi9sUJ4xYSQi/4J3fqMEvPMKPexwJGP6xIqFMWHkmxZiI94pZBaoqtvhSMb0iTVDGRNe6UAykIL3CsOYQcmuLIwJIxFZjnd1vHxgjKre53AkY/rEZp01JkxE5AtAu6o+41uLe62IXKqq7zidzZjesisLY4wxAVmfhTHGmICsWBhjjAnIioUxxpiArFgYY4wJyIqFMcaYgKxYGGOMCciKhTHGmICsWBhjjAno/wPDYQvJgedJHgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "y.backward(torch.ones_like(x),retain_graph=True)\n",
    "xyplot(x,x.grad,'grad of sigmoid')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Tanh Function\n",
    "\n",
    "Like the sigmoid function, the tanh (Hyperbolic Tangent)\n",
    "function also squashes its inputs,\n",
    "transforms them into elements on the interval between -1 and 1:\n",
    "\n",
    "$$\\text{tanh}(x) = \\frac{1 - \\exp(-2x)}{1 + \\exp(-2x)}.$$\n",
    "\n",
    "We plot the tanh function blow. Note that as the input nears 0, the tanh function approaches a linear transformation. Although the shape of the function is similar to the sigmoid function, the tanh function exhibits point symmetry about the origin of the coordinate system.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAEKCAYAAAA1qaOTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xl8XPV97vHPI8mS993YxjvEbMZgg3DANAuLE0N7IW020iZ1mqROc0O2Nm0g3Ca5pGlIc3tp2qZNXEJLlkIKSYpvgBDWpImBWjbGK44XjCXLYHmRvMjW+r1/zHEyFpIt2zM6M5rn/XrNa+ac8ztnHtkjfeec3znnp4jAzMzsdJWlHcDMzPoHFxQzM8sJFxQzM8sJFxQzM8sJFxQzM8sJFxQzM8sJFxQzM8sJFxQzM8sJFxQzM8uJirQD9KWxY8fG9OnT045hZlZUVqxYsTsixp2oXUkVlOnTp1NTU5N2DDOzoiLp5d608yEvMzPLCRcUMzPLCRcUMzPLCRcUMzPLCRcUMzPLiVQLiqS7Je2StLaH5ZL095I2S1ot6ZKsZYskbUoei/outZmZdSftPZR/AxYeZ/l1wMzksRj4ZwBJo4HPA68H5gGflzQqr0nNzOy4Ur0OJSJ+Lmn6cZrcCHw7MuMUPytppKSJwJuBxyJiL4Ckx8gUpnvzm9jMTkdE0NLeSXNrB82t7Rxu7aC5tYMjbR10dAZtnUFHZyftHUFHZ9DeGbR3me7oDDojiIBItpnZdvIeZC/LTB+zPGtdstpkz+ujf4y+fDcWzZ/OmKFVeX2PQr+wcRJQmzVdl8zraf5rSFpMZu+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J6kxmUSQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=Variable(torch.arange(-8.0,8.0,0.1,dtype=torch.float32).reshape(int(16/0.1),1),requires_grad=True)\n",
    "y=torch.tanh(x)\n",
    "xyplot(x,y,\"tanh\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The derivative of the Tanh function is:\n",
    "\n",
    "$$\\frac{d}{dx} \\mathrm{tanh}(x) = 1 - \\mathrm{tanh}^2(x).$$\n",
    "\n",
    "The derivative of tanh function is plotted below.\n",
    "As the input nears 0,\n",
    "the derivative of the tanh function approaches a maximum of 1.\n",
    "And as we saw with the sigmoid function,\n",
    "as the input moves away from 0 in either direction,\n",
    "the derivative of the tanh function approaches 0."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xl4nHd57vHvM1qszdbuVbLlRYnjJM7mhCUhLCEkJCGhhdIECNCFnJQGKJTSUFpKoedAw+lCIfQQIFCWhpKwudQhFAhNaDbL2RzbMVYc25I3yZIsW/syz/ljZpSJomUkzzvvjHR/rstY886rmcdE0q3fbu6OiIgIQCTsAkREJHsoFEREZIxCQURExigURERkjEJBRETGKBRERGSMQkFERMYoFEREZIxCQURExuSHXcBM1dTUeENDQ9hliIjklG3bth1z99rp7su5UGhoaKCpqSnsMkREcoqZ7U/lPnUfiYjIGIWCiIiMUSiIiMgYhYKIiIxRKIiIyJjAQsHM7j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gWnfvC7mcrUCjma02s0JiA4CbQ64JiyX514Bd7v4PYdeT4O4fc/e6+NfU9cAvsyQQiH9tt5jZ6fFLlwE7Qywp4QDwcjMrif93vYwABsDnZEthGu8FPh8fqBkAbgq5noQ7gTvN7BlgCHh3yL/55oIvAguA/4q3Yh5x95vDKMTdR8zsFuA+YrNC7nT3HWHUMs7FwI3AdjN7Mn7tL+Lnp8vk3g98Jx7we4HfC7ke4l1Z9wCPE+sufYIAVjZrRbOIiIyZj91HIiIyCYWCiIiMUSiIiMgYhYKIiIxRKIiIyBiFgoiIjFEoiIjIGIWCyCkyswvjZzoUmVlpfL/7s8KuS2Q2tHhNJA3M7G+J7eFTTGzfnM+EXJLIrCgURNIgvh3CVmJbp7zS3UdDLklkVtR9JJIeVUAZsJBYi0EkJ6mlIJIGZraZ2Glrq4Fl7n5LyCWJzMp83CVVJK3M7F3AiLv/W/ys5ofM7HXu/suwaxOZKbUURERkjMYURERkjEJBRETGKBRERGSMQkFERMYoFEREZIxCQURExigURERkjEJBRETG/H+HMIGuxZTIPwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "y.backward(torch.ones_like(x),retain_graph=True)\n",
    "xyplot(x,x.grad,\"grad of tanh\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In summary, we now know how to incorporate nonlinearities\n",
    "to build expressive multilayer neural network architectures.\n",
    "As a side note, your knowledge now already\n",
    "puts you in command of the state of the art in deep learning, circa 1990.\n",
    "In fact, you have an advantage over anyone working the 1990s,\n",
    "because you can leverage powerful open-source deep learning frameworks\n",
    "to build models rapidly, using only a few lines of code.\n",
    "Previously, getting these nets training\n",
    "required researchers to code up thousands of lines of C and Fortran.\n",
    "\n",
    "## Summary\n",
    "\n",
    "* The multilayer perceptron adds one or multiple fully-connected hidden layers between the output and input layers and transforms the output of the hidden layer via an activation function.\n",
    "* Commonly-used activation functions include the ReLU function, the sigmoid function, and the tanh function.\n",
    "\n",
    "\n",
    "## Exercises\n",
    "\n",
    "1. Compute the derivative of the tanh and the pReLU activation function.\n",
    "1. Show that a multilayer perceptron using only ReLU (or pReLU) constructs a continuous piecewise linear function.\n",
    "1. Show that $\\mathrm{tanh}(x) + 1 = 2 \\mathrm{sigmoid}(2x)$.\n",
    "1. Assume we have a multilayer perceptron *without* nonlinearities between the layers. In particular, assume that we have $d$ input dimensions, $d$ output dimensions and that one of the layers had only $d/2$ dimensions. Show that this network is less expressive (powerful) than a single layer perceptron.\n",
    "1. Assume that we have a nonlinearity that applies to one minibatch at a time. What kinds of problems to you expect this to cause?\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
